diff --git a/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java b/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java index 4aa4acc6f9..14adb1e019 100644 --- a/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java +++ b/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java @@ -543,6 +543,7 @@ private Map collectParts() { } if (isProhibitedUnitType(entity, false)) { + logger.info("skipping " + unit.getName() + " as it is prohibited."); continue; } @@ -727,8 +728,12 @@ private void applyWarehouseWeightModifiers(Map partsList) { continue; } - PartDetails partDetails = new PartDetails(part, weight); + // This prevents us accidentally adding new items to the pool + if (!partsList.containsKey(getPartKey(part))) { + continue; + } + PartDetails partDetails = new PartDetails(part, weight); partsList.merge(getPartKey(part), partDetails, (oldValue, newValue) -> { oldValue.setWeight(oldValue.getWeight() - newValue.getWeight()); return oldValue;