Skip to content

Commit

Permalink
Merge pull request #4671 from MegaMek/name_loading_fix
Browse files Browse the repository at this point in the history
check for units without operators
  • Loading branch information
IllianiCBT authored Aug 18, 2024
2 parents c515f9c + 9bbbc0f commit 03786aa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion MekHQ/src/mekhq/campaign/force/Force.java
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,8 @@ public void setOverrideForceCommanderID(UUID overrideForceCommanderID) {
*/
public List<UUID> getEligibleCommanders(Campaign campaign) {
List<UUID> eligibleCommanders = getUnits().stream()
.map(unitId -> campaign.getUnit(unitId).getCommander().getId())
.map(unitId -> campaign.getUnit(unitId).getCommander() != null ?
campaign.getUnit(unitId).getCommander().getId() : null)
.filter(Objects::nonNull)
.collect(Collectors.toList());

Expand Down

0 comments on commit 03786aa

Please sign in to comment.