Prevent crash when moving Tholian.
authorEric S. Raymond <esr@thyrsus.com>
Tue, 28 Feb 2017 18:30:49 +0000 (13:30 -0500)
committerEric S. Raymond <esr@thyrsus.com>
Tue, 28 Feb 2017 18:30:49 +0000 (13:30 -0500)
sst.py

diff --git a/sst.py b/sst.py
index 3b00bd6dc994c64f2e2a94443f6e1c448ab4ace8..234d37ba9b1d324c4f72040d73241c15db7eda62 100755 (executable)
--- a/sst.py
+++ b/sst.py
@@ -319,7 +319,9 @@ class Enemy:
         else:
             self.location = Coord()
             self.kdist = self.kavgd = None
-            game.enemies.remove(self)
+            # Guard prevents failure on Tholian or thingy
+            if self in game.enemies:
+                game.enemies.remove(self)
         return motion
     def __repr__(self):
         return "<%s,%s.%f>" % (self.type, self.location, self.power)        # For debugging