From 37b67363ce5a9ec734efd18faac7f21fb043b087 Mon Sep 17 00:00:00 2001 From: Alexey Kulish Date: Sat, 14 Oct 2017 17:40:35 +0300 Subject: [PATCH] Fix #4300 --- .../osmand/plus/activities/MapActivityActions.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 56ce3bb1f5..0df03f40e1 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -366,12 +366,14 @@ public class MapActivityActions implements DialogProvider { mapActivity.getRoutingHelper().setGpxParams(params); settings.FOLLOW_THE_GPX_ROUTE.set(result.path); if (!ps.isEmpty()) { - Location loc = ps.get(ps.size() - 1); + Location startLoc = ps.get(0); + Location finishLoc = ps.get(ps.size() - 1); TargetPointsHelper tg = mapActivity.getMyApplication().getTargetPointsHelper(); - tg.navigateToPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, -1); - if (tg.getPointToStart() == null) { - loc = ps.get(0); - tg.setStartPoint(new LatLon(loc.getLatitude(), loc.getLongitude()), false, null); + tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), false, -1); + if (startLoc != finishLoc) { + tg.setStartPoint(new LatLon(startLoc.getLatitude(), startLoc.getLongitude()), false, null); + } else { + tg.clearStartPoint(false); } } }