Skip to content

Commit

Permalink
Merge pull request #4810 from SJuliez/Bay_fix
Browse files Browse the repository at this point in the history
Fix AbstractSmallCraftASFBay: Add null guard for game
  • Loading branch information
SJuliez authored Sep 28, 2023
2 parents ba4cb00 + d1d6c3c commit e685195
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion megamek/src/megamek/common/AbstractSmallCraftASFBay.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ public double spaceForUnit(Entity unit) {
@Override
public double getUnused() {
// loaded fighter squadrons can change size, therefore always update this
int used = troops.stream().map(game::getEntity).mapToInt(t -> (int) spaceForUnit(t)).sum();
int used = 0;
if (game != null) {
used = troops.stream()
.map(game::getEntity)
.mapToInt(t -> (int) spaceForUnit(t))
.sum();
}
currentSpace = totalSpace - used;
return currentSpace - getBayDamage();
}
Expand Down

0 comments on commit e685195

Please sign in to comment.