diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 585ba2717e..c9c62bb3db 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -302,7 +302,8 @@ public class RoutingHelper { private Location setCurrentLocation(Location currentLocation, boolean returnUpdatedLocation, RouteCalculationResult previousRoute, boolean targetPointsChanged) { Location locationProjection = currentLocation; - if (isPublicTransportMode() && currentLocation != null) { + if (isPublicTransportMode() && currentLocation != null && finalLocation != null && + (targetPointsChanged || transportRoutingHelper.getRoutes() == null)) { transportRoutingHelper.setFinalAndCurrentLocation(finalLocation, new LatLon(currentLocation.getLatitude(), currentLocation.getLongitude())); } diff --git a/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java index 5f938b463b..3f5e4bc83c 100644 --- a/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/TransportRoutingHelper.java @@ -466,6 +466,10 @@ public class TransportRoutingHelper { } catch (InterruptedException e) { // ignore } + if (params.calculationProgress.isCancelled) { + walkingSegmentsToCalculate.clear(); + walkingSegmentsCalculated = true; + } } } } @@ -493,10 +497,10 @@ public class TransportRoutingHelper { String error = null; try { res = calculateRouteImpl(params); - if (res != null) { + if (res != null && !params.calculationProgress.isCancelled) { calculateWalkingRoutes(res); } - } catch (IOException e) { + } catch (Exception e) { error = e.getMessage(); log.error(e); }