Skip to content

Commit

Permalink
Merge pull request #1405 from MegaMek/system_crit_cme
Browse files Browse the repository at this point in the history
Fix concurrent modification exception when resetting system crits
  • Loading branch information
SJuliez authored Feb 1, 2024
2 parents fe3f6ed + 3d7406a commit 43e80e1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions megameklab/src/megameklab/ui/mek/BMStructureTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -325,12 +325,12 @@ && getMech().getCritical(Mech.LOC_RT, i).getType() == CriticalSlot.TYPE_EQUIPMEN
getMech().setCritical(Mech.LOC_CT, lgSlot, crit);
}
// Replace any fixed spreadable equipment
for (Mounted mount : getMech().getMisc()) {
if ((mount.getLocation() == Entity.LOC_NONE)
&& UnitUtil.isFixedLocationSpreadEquipment(mount.getType())) {
UnitUtil.removeMounted(getMech(), mount);
MekUtil.createSpreadMounts(getMech(), mount.getType());
}
List<Mounted> toRemove = getMech().getMisc().stream()
.filter(m -> (m.getLocation() == Entity.LOC_NONE) && UnitUtil.isFixedLocationSpreadEquipment(m.getType()))
.collect(Collectors.toList());
for (Mounted mounted : toRemove) {
UnitUtil.removeMounted(getMech(), mounted);
MekUtil.createSpreadMounts(getMech(), mounted.getType());
}
refresh.refreshBuild();
}
Expand Down

0 comments on commit 43e80e1

Please sign in to comment.