From fdc9e84e343d22d161cfbadc2e67649e7b2d0a8e Mon Sep 17 00:00:00 2001 From: kuronekochomusuke Date: Wed, 20 Mar 2024 17:19:05 -0400 Subject: [PATCH] fix npe on skip movement --- .../megamek/client/ui/swing/MovementDisplay.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/megamek/src/megamek/client/ui/swing/MovementDisplay.java b/megamek/src/megamek/client/ui/swing/MovementDisplay.java index 79ef3e8ed28..f16a3fec1af 100644 --- a/megamek/src/megamek/client/ui/swing/MovementDisplay.java +++ b/megamek/src/megamek/client/ui/swing/MovementDisplay.java @@ -1653,7 +1653,8 @@ && ce().canUnjamRAC() if (needNagForOther()) { if ((ce() != null) - && (null != cmd)) { + && (null != cmd) + && ce().isAero()) { boolean airborneOrSpaceborne = ce().isAirborne() || ce().isSpaceborne(); boolean unusedVelocity = false; @@ -1667,7 +1668,6 @@ && ce().canUnjamRAC() || cmd.contains(MoveStepType.RETURN); if (airborneOrSpaceborne && !clientgui.getClient().getGame().useVectorMove() - && ce().isAero() && !((IAero) ce()).isOutControlTotal() && unusedVelocity && !offOrReturn @@ -1697,16 +1697,16 @@ && ce().isAssaultDropInProgress() } if (needNagForOther()) { - if (ce() != null) { + if (ce() != null + && (ce() instanceof Infantry) + && ((Infantry) ce()).hasMicrolite() + ) { boolean finalElevation = (ce().getElevation() != cmd.getFinalElevation()); boolean airborneVTOLOrWIGEOrFinalElevation = ce().isAirborneVTOLorWIGE() || finalElevation; int terrainLevelBuilding = ce().getGame().getBoard().getHex(cmd.getFinalCoords()).terrainLevel(Terrains.BLDG_ELEV); int terrainLevelBridge = ce().getGame().getBoard().getHex(cmd.getFinalCoords()).terrainLevel(Terrains.BRIDGE_ELEV); - if ((ce() != null) - && (ce() instanceof Infantry) - && ((Infantry) ce()).hasMicrolite() - && airborneVTOLOrWIGEOrFinalElevation + if (airborneVTOLOrWIGEOrFinalElevation && !cmd.contains(MoveStepType.FORWARDS) && !cmd.contains(MoveStepType.FLEE) && cmd.getFinalElevation() > 0