# HG changeset patch # User nemo # Date 1618342811 14400 # Node ID 6409d756e9da8eedce09a2b6d8978386f1f78366 # Parent b836876d7b2e6edec783fcaf46affe027a854dbe bug #823 missing nil checks crasher introduced in r4aa19b21707d diff -r b836876d7b2e -r 6409d756e9da hedgewars/uAmmos.pas --- a/hedgewars/uAmmos.pas Mon Apr 05 04:05:14 2021 +0200 +++ b/hedgewars/uAmmos.pas Tue Apr 13 15:40:11 2021 -0400 @@ -406,7 +406,7 @@ CurWeapon:= GetCurAmmoEntry(Hedgehog); OldWeapon:= GetCurAmmoEntry(Hedgehog); - if (Hedgehog.Gear^.State and gstHHDriven) = 0 then + if (Hedgehog.Gear <> nil) and (Hedgehog.Gear^.State and gstHHDriven = 0) then Hedgehog.CurAmmoType:= amNothing else if (CurWeapon^.Count = 0) then SwitchToFirstLegalAmmo(Hedgehog) @@ -431,7 +431,7 @@ s:= s + ansistring(' (' + IntToStr(Count) + ')'); if (Propz and ammoprop_Timerable) <> 0 then s:= s + ansistring(', ' + IntToStr(Timer div 1000) + ' ') + trammo[sidSeconds]; - if (Hedgehog.Gear^.State and gstHHDriven) <> 0 then + if (Hedgehog.Gear <> nil) and (Hedgehog.Gear^.State and gstHHDriven <> 0) then AddCaption(s, Team^.Clan^.Color, capgrpAmmoinfo); if (Propz and ammoprop_NeedTarget) <> 0 then begin