Fix crash when trying to open ammo menu with current team hog gear = nil
authorWuzzy <almikes@aol.com>
Mon, 10 Apr 2017 20:56:01 +0200
changeset 12221 5b525d041fb4
parent 12220 2cbc57db82e1
child 12222 a6cd48b8ef61
Fix crash when trying to open ammo menu with current team hog gear = nil Also fixes crash in A Classic Fairytale, mission 2 when rightclicking at Brainiac intro sequence (#142)
hedgewars/uCommandHandlers.pas
--- a/hedgewars/uCommandHandlers.pas	Mon Apr 10 19:08:00 2017 +0200
+++ b/hedgewars/uCommandHandlers.pas	Mon Apr 10 20:56:01 2017 +0200
@@ -554,7 +554,7 @@
 
             if bShowAmmoMenu then
                 bShowAmmoMenu:= false
-            else if not(CurrentTeam^.Extdriven) and (((Gear^.State and (gstAttacking or gstAttacked)) <> 0)
+            else if not(CurrentTeam^.Extdriven) and ((Gear = nil) or ((Gear^.State and (gstAttacking or gstAttacked)) <> 0)
             or ((Gear^.State and gstHHDriven) = 0)) then
                 begin
                 end