diff --git a/megamek/src/megamek/client/ui/swing/boardview/FiringArcSpriteHandler.java b/megamek/src/megamek/client/ui/swing/boardview/FiringArcSpriteHandler.java index 19e76935acc..b3b46f3ab76 100644 --- a/megamek/src/megamek/client/ui/swing/boardview/FiringArcSpriteHandler.java +++ b/megamek/src/megamek/client/ui/swing/boardview/FiringArcSpriteHandler.java @@ -64,9 +64,18 @@ public FiringArcSpriteHandler(BoardView boardView, ClientGUI clientGUI) { * @param weapon the selected weapon * @param movePath planned movement in the movement phase */ - public void update(Entity entity, WeaponMounted weapon, @Nullable MovePath movePath) { + public void update(@Nullable Entity entity, @Nullable WeaponMounted weapon, @Nullable MovePath movePath) { firingEntity = entity; + if ((entity == null) || (weapon == null)) { + clearValues(); + return; + } int weaponId = entity.getEquipmentNum(weapon); + if (weaponId == -1) { + // entities are replaced all the time by server-sent changes, must always guard + clearValues(); + return; + } // findRanges must be called before any call to testUnderWater due to usage of // global-style variables for some reason findRanges(weapon);