Add nil check to shotgun shell
authornemo
Wed, 24 Feb 2010 13:46:02 +0000
changeset 2858 4c5c4bc0ae35
parent 2857 768dfbe276a5
child 2859 d44ae883896b
Add nil check to shotgun shell
hedgewars/GSHandlers.inc
--- a/hedgewars/GSHandlers.inc	Wed Feb 24 13:29:06 2010 +0000
+++ b/hedgewars/GSHandlers.inc	Wed Feb 24 13:46:02 2010 +0000
@@ -477,9 +477,12 @@
 		begin
 		PlaySound(sndShotgunFire);
 		shell:= AddVisualGear(hwRound(Gear^.x), hwRound(Gear^.y), vgtShell);
-		shell^.dX:= gear^.dX / -4;
-		shell^.dY:= gear^.dY / -4;
-		shell^.Frame:= 0;
+        if shell <> nil then
+        begin 
+           shell^.dX:= gear^.dX / -4;
+           shell^.dY:= gear^.dY / -4;
+           shell^.Frame:= 0
+        end;
 		Gear^.State:= Gear^.State or gstAnimation
 		end;
 	exit