From 7ab4ae98e9c56263716e1060c98586dc06e5981e Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 31 Aug 2012 23:26:28 +0200 Subject: [PATCH] Fix NPE --- OsmAnd/src/net/osmand/plus/activities/MapActivity.java | 2 +- OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index 198427a4e6..5b09233c4a 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -844,7 +844,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe // Update information mapLayers.getLocationLayer().setLastKnownLocation(updatedLocation); - if (location != null) { + if (updatedLocation != null) { updateAutoMapViewConfiguration(updatedLocation); } else { if (mapLayers.getMapInfoLayer().getBackToLocation().isEnabled()) { diff --git a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java index 8b83ca2c49..13aef334f6 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java +++ b/OsmAnd/src/net/osmand/plus/routing/RoutingHelper.java @@ -242,7 +242,7 @@ public class RoutingHelper { route.isCalculated()? route : null); } double projectDist = mode == ApplicationMode.CAR ? posTolerance : posTolerance / 2; - if(returnUpdatedLocation && currentLocation.distanceTo(locationProjection) < projectDist) { + if(returnUpdatedLocation && locationProjection != null && currentLocation.distanceTo(locationProjection) < projectDist) { return locationProjection; } else { return currentLocation;