From f6ce5f59ae5da52751c955cca522eae2f93a0167 Mon Sep 17 00:00:00 2001
From: Christoph Oelckers <coelckers@users.noreply.github.com>
Date: Tue, 22 Jan 2019 00:36:15 +0100
Subject: [PATCH] - fixed armor bonus giving in A_CustomPunch

---
 .../zscript/inventory/stateprovider.txt       | 19 +++++++++++--------
 1 file changed, 11 insertions(+), 8 deletions(-)

diff --git a/wadsrc/static/zscript/inventory/stateprovider.txt b/wadsrc/static/zscript/inventory/stateprovider.txt
index f26db87be..bed30ffd5 100644
--- a/wadsrc/static/zscript/inventory/stateprovider.txt
+++ b/wadsrc/static/zscript/inventory/stateprovider.txt
@@ -297,15 +297,18 @@ class StateProvider : Inventory
 					}
 					if (armorbonustype != NULL)
 					{
-						let armorbonus = ArmorBonus(Spawn(armorbonustype));
-						armorbonus.SaveAmount *= int(actualdamage * lifesteal);
-						if (lifestealmax > 0) armorbonus.MaxSaveAmount = lifestealmax;
-						armorbonus.bDropped = true;
-						armorbonus.ClearCounters();
-
-						if (!armorbonus.CallTryPickup(self))
+						let armorbonus = BasicArmorBonus(Spawn(armorbonustype));
+						if (armorbonus)
 						{
-							armorbonus.Destroy ();
+							armorbonus.SaveAmount *= int(actualdamage * lifesteal);
+							if (lifestealmax > 0) armorbonus.MaxSaveAmount = lifestealmax;
+							armorbonus.bDropped = true;
+							armorbonus.ClearCounters();
+
+							if (!armorbonus.CallTryPickup(self))
+							{
+								armorbonus.Destroy ();
+							}
 						}
 					}
 				}