From fd88fd347d2bdcfe6f39b304dd68efbf55c1b14e Mon Sep 17 00:00:00 2001 From: PaulStets Date: Mon, 29 Jan 2018 15:22:47 +0200 Subject: [PATCH] Added check for exsiting intermediates --- .../net/osmand/plus/views/PointNavigationLayer.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java index 6e0d1f9de2..c0a0f06942 100644 --- a/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/PointNavigationLayer.java @@ -251,10 +251,14 @@ public class PointNavigationLayer extends OsmandMapLayer implements newTargetPoint = targetPointsHelper.getPointToNavigate(); } else if (oldPoint.intermediate) { List points = targetPointsHelper.getIntermediatePointsWithTarget(); - newTargetPoint = new TargetPoint(position, - new PointDescription(PointDescription.POINT_TYPE_LOCATION, "")); - points.set(points.indexOf(oldPoint), newTargetPoint); - targetPointsHelper.reorderAllTargetPoints(points, true); + int i = points.indexOf(oldPoint); + if (i != -1) { + newTargetPoint = new TargetPoint(position, + new PointDescription(PointDescription.POINT_TYPE_LOCATION, "")); + points.set(i, newTargetPoint); + targetPointsHelper.reorderAllTargetPoints(points, true); + } + } result = true; }