fix for Issue 855: Failure to teleport rarely makes engine crash
authorsheepluva
Mon, 15 Dec 2014 19:37:44 +0100
changeset 10676 7111b4a46b5c
parent 10675 cc3dea58794d
child 10677 328f526c95b6
fix for issue #855: Failure to teleport rarely makes engine crash
hedgewars/uGearsHandlersMess.pas
--- a/hedgewars/uGearsHandlersMess.pas	Mon Dec 15 16:11:18 2014 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Mon Dec 15 19:37:44 2014 +0100
@@ -2660,12 +2660,13 @@
         HHGear^.Message := HHGear^.Message and (not gmAttack);
         HHGear^.State := HHGear^.State and (not gstAttacking);
         HHGear^.State := HHGear^.State or gstHHChooseTarget;
-        DeleteGear(Gear);
         isCursorVisible := true;
         warn:= AddVisualGear(Gear^.Target.X, oy, vgtNoPlaceWarn, 0, true);
         if warn <> nil then
             warn^.Tex := GetPlaceCollisionTex(lx, ty, sprHHTelepMask, 0);
-        PlaySound(sndDenied)
+        DeleteGear(Gear);
+        PlaySound(sndDenied);
+        exit
         end
     else
         begin