share/hedgewars/Data/Scripts/Animate.lua
changeset 13032 91f23558c936
parent 12778 cb29ec085767
child 13684 739fd039daaa
--- a/share/hedgewars/Data/Scripts/Animate.lua	Sat Feb 17 20:59:56 2018 +0100
+++ b/share/hedgewars/Data/Scripts/Animate.lua	Mon Feb 19 09:45:36 2018 +0100
@@ -425,6 +425,11 @@
 -------------------------------------Misc---------------------------------
 
 function StoppedGear(gear)
+  -- GetHealth returns nil if gear does not exist
+  if not GetHealth(gear) then
+     -- We consider the gear to be “stopped” if it has been destroyed
+     return true
+  end
   dx,dy = GetGearVelocity(gear)
   return math.abs(dx) <= 1 and math.abs(dy) <= 1
 end