mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-10-13 15:50:59 +00:00
fixing NoSuchElementException in TrackedRaceImpl.updateStartToNextMarkCacheInvalidationCacheListenersAfterWaypointRemoved for empty course
This commit is contained in:
1 parent
9c0d011416
commit
e2089f4e70
1 file changed
+7
-5
+7
-5
@@ -1626,12 +1626,14 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
|
||||
clearDirectionFromStartToNextMarkCache();
|
||||
stopAndRemoveStartToNextMarkCacheInvalidationListener(waypointThatGotRemoved);
|
||||
Iterator<Waypoint> waypointsIter = getRace().getCourse().getWaypoints().iterator();
|
||||
waypointsIter.next(); // skip first
|
||||
if (waypointsIter.hasNext()) {
|
||||
waypointsIter.next(); // skip second
|
||||
if (waypointsIter.hasNext()) { // catches the case of a course being empty
|
||||
waypointsIter.next(); // skip first
|
||||
if (waypointsIter.hasNext()) {
|
||||
Waypoint newSecond = waypointsIter.next();
|
||||
addStartToNextMarkCacheInvalidationListener(newSecond);
|
||||
waypointsIter.next(); // skip second
|
||||
if (waypointsIter.hasNext()) {
|
||||
Waypoint newSecond = waypointsIter.next();
|
||||
addStartToNextMarkCacheInvalidationListener(newSecond);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user