There was a null pointer exception when finishing the race, as the finish leg doesn't have compound marks.

main
fjc40 8 years ago
parent 11a50b6f09
commit 75c15d492e

@ -429,6 +429,7 @@ public class RaceViewController extends Controller {
@Override @Override
public void handle(long now) { public void handle(long now) {
CompoundMark target = boat.getCurrentLeg().getEndCompoundMark(); CompoundMark target = boat.getCurrentLeg().getEndCompoundMark();
if (target != null) {
Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate()); Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate());
nextMarkArrow.setX(view3D.getPivot().getX()); nextMarkArrow.setX(view3D.getPivot().getX());
@ -436,6 +437,7 @@ public class RaceViewController extends Controller {
nextMarkArrow.setZ(view3D.getPivot().getZ() + 15); nextMarkArrow.setZ(view3D.getPivot().getZ() + 15);
nextMarkArrow.setHeading(headingToMark.degrees()); nextMarkArrow.setHeading(headingToMark.degrees());
} }
}
}; };
arrowToNextMark.start(); arrowToNextMark.start();
} }

Loading…
Cancel
Save