diff --git a/src/main/java/seng302/Model/BoatInRace.java b/src/main/java/seng302/Model/BoatInRace.java index 560feb21..c20770ea 100644 --- a/src/main/java/seng302/Model/BoatInRace.java +++ b/src/main/java/seng302/Model/BoatInRace.java @@ -20,7 +20,6 @@ public class BoatInRace extends Boat { private long timeFinished; private Color colour; private boolean finished = false; - private StringProperty currentLegName; /** * Constructor method. @@ -31,7 +30,6 @@ public class BoatInRace extends Boat { public BoatInRace(String name, double velocity, Color colour, String abbrev) { super(name, velocity, abbrev); setColour(colour); - currentLegName = new SimpleStringProperty(""); } /** @@ -92,10 +90,15 @@ public class BoatInRace extends Boat { */ public void setCurrentLeg(Leg currentLeg) { this.currentLeg = currentLeg; - this.currentLegName.setValue(currentLeg.getName()); } public StringProperty getCurrentLegName(){ + + StringProperty currentLegName = new SimpleStringProperty(""); + if (currentLeg != null) { + currentLegName.setValue(currentLeg.getName()); + } + return currentLegName; } @@ -132,7 +135,6 @@ public class BoatInRace extends Boat { this.finished = bool; } - /** * Calculates the bearing of the travel via map coordinates of the raceMarkers * @return the heading that the boat is heading towards in degrees.