From 72e823744c9493a150988b72e8e07c84f534a965 Mon Sep 17 00:00:00 2001 From: MagicBot Date: Sun, 30 Apr 2023 08:37:08 -0400 Subject: [PATCH] Some meshes might not have slot locations. --- src/engine/gameManager/BuildingManager.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/engine/gameManager/BuildingManager.java b/src/engine/gameManager/BuildingManager.java index ee1750a0..1f2141e8 100644 --- a/src/engine/gameManager/BuildingManager.java +++ b/src/engine/gameManager/BuildingManager.java @@ -38,6 +38,14 @@ public enum BuildingManager { public static int getAvailableSlot(Building building) { + ArrayList slotLocations = _slotLocations.get(building.meshUUID); + + // Some meshes might not have slot locations assigned. + + if (slotLocations == null || + slotLocations.isEmpty()) + return -1; + int numOfSlots = _slotLocations.get(building.meshUUID).size(); for (int i = 1; i <= numOfSlots; i++) {