Skip to content

Commit

Permalink
Merge pull request MegaMek#5331 from AaronGullickson/fix-3978
Browse files Browse the repository at this point in the history
Fix MegaMek#3978 [MekHQ]: NPE When Attempting to Save (Manual or Auto)
  • Loading branch information
SJuliez authored Apr 8, 2024
2 parents 6e92370 + 33ec418 commit 09f3440
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions megamek/src/megamek/common/EntityListFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ public static void writeEntityList(Writer output, ArrayList<Entity> list) throws
output.write("\" " + MULParser.ATTR_QUIRKS + "=\"");
output.write(String.valueOf(entity.getQuirkList("::")));
}
if (entity.getC3Master() != null) {
if ((entity.getGame() != null) && (entity.getC3Master() != null)) {
output.write("\" " + MULParser.ATTR_C3MASTERIS + "=\"");
output.write(entity.getGame()
.getEntity(entity.getC3Master().getId())
Expand Down Expand Up @@ -1236,7 +1236,8 @@ private static void writeCrewAttributes(Writer output, final Entity entity, fina
} else {
output.write("\" " + MULParser.ATTR_AUTOEJECT + "=\"false");
}
if (entity.game.getOptions().booleanOption(OptionsConstants.RPG_CONDITIONAL_EJECTION)) {
if ((null != entity.getGame())
&& (entity.getGame().getOptions().booleanOption(OptionsConstants.RPG_CONDITIONAL_EJECTION))) {
if (((Mech) entity).isCondEjectAmmo()) {
output.write("\" " + MULParser.ATTR_CONDEJECTAMMO + "=\"true");
} else {
Expand Down

0 comments on commit 09f3440

Please sign in to comment.