Skip to content

Commit

Permalink
Fix IndexOutOfBoundsException
Browse files Browse the repository at this point in the history
  • Loading branch information
Dima-1 committed Jul 26, 2023
1 parent e214891 commit 1e10c63
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1079,9 +1079,12 @@ public List<WptPt> setPoints(GpxRouteApproximation gpxApproximation, List<WptPt>
return routePoints;
}

private boolean needDuplicatePoint(List<GpxPoint> gpxPoints, int i) {
List<RouteSegmentResult> routeToTarget = gpxPoints.get(i).routeToTarget;
List<RouteSegmentResult> routeToTargetNext = gpxPoints.get(i + 1).routeToTarget;
private boolean needDuplicatePoint(List<GpxPoint> gpxPoints, int index) {
if (index == gpxPoints.size() - 1) {
return false;
}
List<RouteSegmentResult> routeToTarget = gpxPoints.get(index).routeToTarget;
List<RouteSegmentResult> routeToTargetNext = gpxPoints.get(index + 1).routeToTarget;
return routeToTarget.get(routeToTarget.size() - 1).getEndPoint()
.equals(routeToTargetNext.get(0).getStartPoint());
}
Expand Down

0 comments on commit 1e10c63

Please sign in to comment.