Skip to content

Commit

Permalink
fix: added two null checks that were missing
Browse files Browse the repository at this point in the history
  • Loading branch information
Scoppio committed Jan 20, 2025
1 parent 78a3c6e commit ce96d19
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion megamek/i18n/megamek/common/messages.properties
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ acar.jump_modifier=Movement modifier
acar.withdraw.crippled=Crippled

AutoResolveSimulationLogDialog.title=Auto Resolve Report

AutoResolveSimulationLogDialog.noReport=Something went wrong and it was not possible to resolve the game

### AutoResolveDialog
AutoResolveMethod.dialog.name=Auto Resolve Chance Dialog
Expand Down
12 changes: 8 additions & 4 deletions megamek/src/megamek/client/ui/swing/lobby/ChatLounge.java
Original file line number Diff line number Diff line change
Expand Up @@ -1931,10 +1931,14 @@ public void actionPerformed(ActionEvent ev) {
}

var event = AutoResolveProgressDialog.showDialog(clientgui.getFrame(), forcesSetups, board);

var autoResolveBattleReport = new AutoResolveSimulationLogDialog(clientgui.getFrame(), event.getLogFile());
autoResolveBattleReport.setModal(true);
autoResolveBattleReport.setVisible(true);
if (event != null) {
var autoResolveBattleReport = new AutoResolveSimulationLogDialog(clientgui.getFrame(), event.getLogFile());
autoResolveBattleReport.setModal(true);
autoResolveBattleReport.setVisible(true);
} else {
clientgui.doAlertDialog(Messages.getString("AutoResolveSimulationLogDialog.title"),
Messages.getString("AutoResolveSimulationLogDialog.noReport"));
}

} else if (ev.getSource() == butDetach) {
butDetach.setEnabled(false);
Expand Down
1 change: 1 addition & 0 deletions megamek/src/megamek/server/totalwarfare/TWGameManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ public void removeAllEntitiesOwnedBy(Player player) {
game.getEntitiesVector().stream()
.filter(e -> e.getOwnerId() != pid)
.filter(Entity::partOfForce)
.filter(e -> forces.getForce(e.getForceId()) != null)
.filter(e -> forces.getForce(e.getForceId()).getOwnerId() == pid)
.forEach(forces::removeEntityFromForces);

Expand Down

0 comments on commit ce96d19

Please sign in to comment.