Skip to content

Commit

Permalink
fix keyerror bug from race condition
Browse files Browse the repository at this point in the history
  • Loading branch information
shadorki committed Sep 29, 2023
1 parent fefd564 commit 1ec1d11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions owo_suit.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,18 @@ def watch(self) -> None:
time.sleep(.3)

def on_collission_enter(self, address: str, *args) -> None:
if not address in self.osc_parameters:
if address not in self.osc_parameters:
return
if len(args) != 1:
return
was_entered: bool = args[0]
if type(was_entered) != bool:
return
muscle = self.osc_parameters[address]
muscle = self.osc_parameters.get(address)
if was_entered:
self.active_muscles.add(muscle)
else:
self.active_muscles.remove(muscle)
self.active_muscles.discard(muscle)

def map_parameters(self, dispatcher: dispatcher.Dispatcher) -> None:
dispatcher.set_default_handler(self.on_collission_enter)
Expand Down

0 comments on commit 1ec1d11

Please sign in to comment.