fsm: Fix "no attribute notifier" error in requestNext/Prev

Fixes #1644
This commit is contained in:
rdb 2024-10-24 16:17:49 +02:00
parent b022fc9301
commit aa0462a35a
1 changed files with 8 additions and 3 deletions

View File

@ -420,10 +420,12 @@ class FSM(DirectObject):
cur_index = self.stateArray.index(self.state)
new_index = (cur_index + 1) % len(self.stateArray)
self.request(self.stateArray[new_index], args)
else:
elif hasattr(self, 'notifier'):
assert self.notifier.debug(
"stateArray empty. Can't switch to next.")
else:
assert self.notify.debug(
"stateArray empty. Can't switch to next.")
finally:
self.fsmLock.release()
@ -438,9 +440,12 @@ class FSM(DirectObject):
cur_index = self.stateArray.index(self.state)
new_index = (cur_index - 1) % len(self.stateArray)
self.request(self.stateArray[new_index], args)
else:
elif hasattr(self, 'notifier'):
assert self.notifier.debug(
"stateArray empty. Can't switch to next.")
else:
assert self.notify.debug(
"stateArray empty. Can't switch to next.")
finally:
self.fsmLock.release()