timer: Fix GSOD on timer conflict resolve
authorMike Looijmans <milo-software@users.sourceforge.net>
Sat, 24 Sep 2011 09:02:06 +0000 (11:02 +0200)
committerMike Looijmans <milo-software@users.sourceforge.net>
Sat, 24 Sep 2011 09:02:06 +0000 (11:02 +0200)
timeChanged may now be called with a timer that wasn't in the list
yet. Handle this with grace. Better than bringing back the bug
that the timer may not be disabled anyway.

timer.py

index f59e5bb..0a67af6 100644 (file)
--- a/timer.py
+++ b/timer.py
@@ -221,8 +221,11 @@ class Timer:
                if timer.state == TimerEntry.StateEnded:
                        self.processed_timers.remove(timer)
                else:
-                       self.timer_list.remove(timer)
-
+                       try:
+                               self.timer_list.remove(timer)
+                       except:
+                               print "[timer] Failed to remove, not in list"
+                               return
                # give the timer a chance to re-enqueue
                if timer.state == TimerEntry.StateEnded:
                        timer.state = TimerEntry.StateWaiting