Fixed null pointer when race finishes #story[1299]
This commit is contained in:
@@ -49,9 +49,13 @@ public class NextMarkController {
|
||||
AnimationTimer arrow2d = new AnimationTimer() {
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
if (boat.getCurrentLeg().getEndCompoundMark() != null) {
|
||||
CompoundMark target = boat.getCurrentLeg().getEndCompoundMark();
|
||||
Bearing headingToMark = GPSCoordinate.calculateBearing(boat.getPosition(), target.getAverageGPSCoordinate());
|
||||
arrowStackPane2d.setRotate(headingToMark.degrees());
|
||||
} else {
|
||||
stop();
|
||||
}
|
||||
}
|
||||
};
|
||||
arrow2d.start();
|
||||
@@ -73,10 +77,14 @@ public class NextMarkController {
|
||||
AnimationTimer arrow3d = new AnimationTimer() {
|
||||
@Override
|
||||
public void handle(long now) {
|
||||
if (boat.getCurrentLeg().getEndCompoundMark() != null) {
|
||||
arrow.getTransforms().clear();
|
||||
double zRotation = calculateZRotate();
|
||||
arrow.setRotate(calculateXRotate(zRotation));
|
||||
arrow.getTransforms().add(new Rotate(zRotation, new Point3D(0, 0, 1)));
|
||||
} else {
|
||||
stop();
|
||||
}
|
||||
}
|
||||
};
|
||||
arrow3d.start();
|
||||
|
||||
Reference in New Issue
Block a user