Skip to content

Commit

Permalink
AbstractSmallCraftASFBay: Add null guard for game
Browse files Browse the repository at this point in the history
  • Loading branch information
SJuliez committed Sep 28, 2023
1 parent ba4cb00 commit d1d6c3c
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 d1d6c3c

Please sign in to comment.