hedgewars/uGearsHedgehog.pas
changeset 13602 f7cbf7d8298d
parent 13573 470982c05f7e
child 13615 f1b6070a6e14
--- a/hedgewars/uGearsHedgehog.pas	Thu Aug 02 01:52:01 2018 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Thu Aug 02 03:16:08 2018 +0200
@@ -830,6 +830,9 @@
      posCaseHealth: begin
                     PlaySound(sndShotgunReload);
                     inc(HH^.Health, Gear^.Health);
+                    // Prevent overflow
+                    if (HH^.Health < 0) or (HH^.Health > cMaxHogHealth) then
+                        HH^.Health:= cMaxHogHealth;
                     HH^.Hedgehog^.Effects[hePoisoned] := 0;
                     RenderHealth(HH^.Hedgehog^);
                     RecountTeamHealth(HH^.Hedgehog^.Team);