Fix public transport routing from my location

This commit is contained in:
crimean 2018-12-17 17:55:58 +03:00
parent 2c53ffd598
commit 28d9289956
2 changed files with 8 additions and 3 deletions

View file

@ -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()));
}

View file

@ -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);
}