Browse Source

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

Fixes #1644
rdb 1 year ago
parent
commit
aa0462a35a
1 changed files with 8 additions and 3 deletions
  1. 8 3
      direct/src/fsm/FSM.py

+ 8 - 3
direct/src/fsm/FSM.py

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