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