From e73b8d2826414279ce1b78ef54eb1a91793bd496 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sat, 9 Sep 2023 10:20:20 -0400 Subject: [PATCH] Harden against null --- src/engine/gameManager/BuildingManager.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index a045c9f6..7c21db71 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -343,7 +343,8 @@ public enum BuildingManager { Mob hirelingMob = (Mob) hireling; if (hirelingMob.getParentZone() != null) - hirelingMob.getParentZone().zoneMobSet.remove(hireling); + if (hirelingMob.getParentZone().zoneMobSet.contains(hirelingMob)) + hirelingMob.getParentZone().zoneMobSet.remove(hireling); } @@ -352,7 +353,8 @@ public enum BuildingManager { NPC hirelingNPC = (NPC) hireling; if (hirelingNPC.getParentZone() != null) - hirelingNPC.getParentZone().zoneNPCSet.remove(hireling); + if (hirelingNPC.getParentZone().zoneNPCSet.contains(hirelingNPC)) + hirelingNPC.getParentZone().zoneNPCSet.remove(hireling); }