add npe checks

This commit is contained in:
MadWasp79 2020-01-29 10:19:23 +02:00
parent 315e1c38a7
commit 5404f626ec
2 changed files with 6 additions and 2 deletions

View file

@ -445,7 +445,9 @@ public class TargetPointsHelper {
Location lastKnownLocation = ctx.getLocationProvider().getLastKnownLocation();
LatLon latLon = lastKnownLocation != null ?
new LatLon(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()) : null;
routingHelper.checkAndUpdateStartLocation(latLon);
if (latLon != null) {
routingHelper.checkAndUpdateStartLocation(latLon);
}
setMyLocationPoint(latLon, false, null);
}
}

View file

@ -174,7 +174,9 @@ public class RoutingHelper {
}
public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, List<LatLon> intermediatePoints, Location currentLocation){
checkAndUpdateStartLocation(currentLocation);
if (currentLocation != null) {
checkAndUpdateStartLocation(currentLocation);
}
RouteCalculationResult previousRoute = route;
clearCurrentRoute(finalLocation, intermediatePoints);
// to update route