Skip to content

Commit

Permalink
Merge pull request #4804 from Sleet01/fix_4790_uncaught_NPE_counterba…
Browse files Browse the repository at this point in the history
…ttery_on_fled_off-board_artillery

Fix #4790: uncaught NPE when Sniper Turret fired on fleeing off-board target
  • Loading branch information
NickAragua authored Sep 27, 2023
2 parents 52f809c + a4109f8 commit b4030d0
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,15 @@ public boolean handle(GamePhase phase, Vector<Report> vPhaseReport) {
}

final Vector<Integer> spottersBefore = aaa.getSpotterIds();

Coords targetPos = target.getPosition();

// Handle counter-battery on fleeing/fled off-board targets.
if (null == targetPos) {
LogManager.getLogger().error(String.format("Artillery Target %s is missing; off-board target fled?", waa.getTargetId()));
return false;
}

final int playerId = aaa.getPlayerId();
boolean targetIsEntity = target.getTargetType() == Targetable.TYPE_ENTITY;
boolean targetIsAirborneVTOL = targetIsEntity && target.isAirborneVTOLorWIGE();
Expand Down

0 comments on commit b4030d0

Please sign in to comment.