Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4790: uncaught NPE when Sniper Turret fired on fleeing off-board target #4804

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,16 @@ 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.
Coords targetPos;
try {
targetPos = target.getPosition();
Sleet01 marked this conversation as resolved.
Show resolved Hide resolved
} catch (Exception e) {
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