Skip to content

Commit

Permalink
Bug fix: Switches actions from non-configured switches would crash
Browse files Browse the repository at this point in the history
  • Loading branch information
toomanybrians committed Aug 7, 2015
1 parent f8ad2b9 commit 9f36eee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions mpf/system/switch_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,24 +265,24 @@ def process_switch(self, name=None, state=1, logical=False, num=None,
"""

# Find the switch name
# todo find a better way to do this ...
if num is not None:

if num is not None: # can't be 'if num:` in case the num is 0.
for switch in self.machine.switches:
if switch.number == num:
name = switch.name
obj = switch
break

elif obj:
name = obj.name

if not obj and name:
elif name:
obj = self.machine.switches[name]
name = obj.name # switches this to the name MPF wants to use

name = obj.name # switches this to the name MPF wants to use

if not name:
else:
self.log.warning("Received a state change from non-configured "
"switch. Number: %s", num)
"switch. Number: %s, Name: %s", num, name)
return

# We need int, but this lets it come in as boolean also
Expand Down
2 changes: 1 addition & 1 deletion version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version_info__ = ('0', '19', '1')
__version_info__ = ('0', '19', '2')
__version__ = '.'.join(__version_info__)

__bcp_version_info__ = ('1', '0')
Expand Down

0 comments on commit 9f36eee

Please sign in to comment.