add npe checks
This commit is contained in:
parent
5404f626ec
commit
2481142f0b
2 changed files with 8 additions and 10 deletions
|
@ -445,9 +445,7 @@ public class TargetPointsHelper {
|
|||
Location lastKnownLocation = ctx.getLocationProvider().getLastKnownLocation();
|
||||
LatLon latLon = lastKnownLocation != null ?
|
||||
new LatLon(lastKnownLocation.getLatitude(), lastKnownLocation.getLongitude()) : null;
|
||||
if (latLon != null) {
|
||||
routingHelper.checkAndUpdateStartLocation(latLon);
|
||||
}
|
||||
routingHelper.checkAndUpdateStartLocation(latLon);
|
||||
setMyLocationPoint(latLon, false, null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -174,9 +174,7 @@ public class RoutingHelper {
|
|||
}
|
||||
|
||||
public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, List<LatLon> intermediatePoints, Location currentLocation){
|
||||
if (currentLocation != null) {
|
||||
checkAndUpdateStartLocation(currentLocation);
|
||||
}
|
||||
checkAndUpdateStartLocation(currentLocation);
|
||||
RouteCalculationResult previousRoute = route;
|
||||
clearCurrentRoute(finalLocation, intermediatePoints);
|
||||
// to update route
|
||||
|
@ -268,10 +266,12 @@ public class RoutingHelper {
|
|||
}
|
||||
|
||||
public void checkAndUpdateStartLocation(LatLon newStartLocation) {
|
||||
LatLon lastStartLocation = app.getSettings().getLastStartPoint();
|
||||
if (lastStartLocation == null || MapUtils.getDistance(newStartLocation, lastStartLocation) > CACHE_RADIUS) {
|
||||
app.getMapViewTrackingUtilities().detectDrivingRegion(newStartLocation);
|
||||
app.getSettings().setLastStartPoint(newStartLocation);
|
||||
if (newStartLocation != null) {
|
||||
LatLon lastStartLocation = app.getSettings().getLastStartPoint();
|
||||
if (lastStartLocation == null || MapUtils.getDistance(newStartLocation, lastStartLocation) > CACHE_RADIUS) {
|
||||
app.getMapViewTrackingUtilities().detectDrivingRegion(newStartLocation);
|
||||
app.getSettings().setLastStartPoint(newStartLocation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue