Quickfix for null pointer in boatObject

#pair[ptg19,kre39]
This commit is contained in:
Kusal Ekanayake
2017-05-21 15:58:17 +12:00
parent cf4d7e03f5
commit 059c0de1fa
+14 -5
View File
@@ -109,9 +109,13 @@ public class BoatGroup extends RaceObject {
teamNameObject.setCacheHint(CacheHint.SPEED);
velocityObject = new Text(String.valueOf(boat.getVelocity()));
DateFormat format = new SimpleDateFormat("mm:ss");
String timeToNextMark = format
// TODO: 21/05/17 make a nice way of checking for this to be null
estTimeToNextMarkObject = new Text("Next mark: null");
if (boat.getEstimateTimeAtNextMark() != null) {
String timeToNextMark = format
.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
estTimeToNextMarkObject = new Text("Next mark: " + timeToNextMark);
estTimeToNextMarkObject = new Text("Next mark: " + timeToNextMark);
}
if (boat.getMarkRoundingTime() != null) {
String elapsedTime = format
.format(StreamParser.getCurrentTimeLong() - boat.getMarkRoundingTime());
@@ -280,9 +284,14 @@ public class BoatGroup extends RaceObject {
velocityObject.setText(String.format("%.2f m/s", boat.getVelocity()));
DateFormat format = new SimpleDateFormat("mm:ss");
// estimate time to next mark
String timeToNextMark = format
.format(boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
estTimeToNextMarkObject.setText("Next mark: " + timeToNextMark);
// TODO: 21/05/17 make a nice way of checking for this to be null
estTimeToNextMarkObject.setText("Next mark: null");
if (boat.getEstimateTimeAtNextMark() != null) {
String timeToNextMark = format
.format(
boat.getEstimateTimeAtNextMark() - StreamParser.getCurrentTimeLong());
estTimeToNextMarkObject.setText("Next mark: " + timeToNextMark);
}
// elapsed time
if (boat.getMarkRoundingTime() != null) {
String elapsedTime = format