--- 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