From 5404f626ec59e8bfbc0a9db7c2827c1048a7e9dc Mon Sep 17 00:00:00 2001 From: MadWasp79 Date: Wed, 29 Jan 2020 10:19:23 +0200 Subject: [PATCH] add npe checks --- OsmAnd/src/net/osmand/plus/TargetPointsHelper.java | 4 +++- OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java b/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java index 046456a172..005e38d71e 100644 --- a/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java +++ b/OsmAnd/src/net/osmand/plus/TargetPointsHelper.java @@ -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); } } diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 401d8c7584..75ca6d2dd0 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -174,7 +174,9 @@ public class RoutingHelper { } public synchronized void setFinalAndCurrentLocation(LatLon finalLocation, List intermediatePoints, Location currentLocation){ - checkAndUpdateStartLocation(currentLocation); + if (currentLocation != null) { + checkAndUpdateStartLocation(currentLocation); + } RouteCalculationResult previousRoute = route; clearCurrentRoute(finalLocation, intermediatePoints); // to update route