diff --git a/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java b/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java index 4e98dab774..3fdc1ef5f4 100644 --- a/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java +++ b/MekHQ/src/mekhq/campaign/mission/resupplyAndCaches/Resupply.java @@ -537,6 +537,7 @@ private Map collectParts() { } if (isProhibitedUnitType(entity, false)) { + logger.info("skipping " + unit.getName() + " as it is prohibited."); continue; } @@ -711,8 +712,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;