nil check
authornemo
Wed, 29 Dec 2010 22:44:45 -0500
changeset 4783 f9564c66a086
parent 4782 603916ddf4b6
child 4784 d8eafc8dba38
nil check
hedgewars/uGears.pas
--- a/hedgewars/uGears.pas	Thu Dec 30 01:44:55 2010 +0100
+++ b/hedgewars/uGears.pas	Wed Dec 29 22:44:45 2010 -0500
@@ -1840,7 +1840,7 @@
     if (x < 4) and (TeamsArray[t] <> nil) then
         begin
             // if team matches current hedgehog team, default to current hedgehog
-            if (i = 0) and (CurrentHedgehog^.Team = TeamsArray[t]) then hh:= CurrentHedgehog
+            if (i = 0) and (CurrentHedgehog <> nil) and (CurrentHedgehog^.Team = TeamsArray[t]) then hh:= CurrentHedgehog
             else 
                 begin
             // otherwise use the first living hog or the hog amongs the remaining ones indicated by i