From a5747c8e911a3bf7c251cee2fa1e2f462b9ca47a Mon Sep 17 00:00:00 2001 From: vshcherb Date: Sat, 29 Mar 2014 21:21:04 +0100 Subject: [PATCH] Fix exception traces --- .../net/osmand/plus/base/MapViewTrackingUtilities.java | 2 +- OsmAnd/src/net/osmand/plus/routing/RouteProvider.java | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java index 3424f3e8a5..b1db7009b6 100644 --- a/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java +++ b/OsmAnd/src/net/osmand/plus/base/MapViewTrackingUtilities.java @@ -282,7 +282,7 @@ public class MapViewTrackingUtilities implements OsmAndLocationListener, IMapLoc @Override public void newRouteIsCalculated(boolean newRoute) { RoutingHelper rh = app.getRoutingHelper(); - if(newRoute && rh.isRoutePlanningMode()) { + if(newRoute && rh.isRoutePlanningMode() && mapView != null) { RotatedTileBox rt = mapView.getCurrentRotatedTileBox(); Location lt = rh.getLastProjection(); if(lt != null) { diff --git a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java index dd4dbb58c5..b8edbb64e3 100644 --- a/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java +++ b/OsmAnd/src/net/osmand/plus/routing/RouteProvider.java @@ -336,9 +336,11 @@ public class RouteProvider { List dt = newRes.getDirections(); List gpxRouteDirections = rParams.gpxRoute.directions; rParams.gpxRoute.points.addAll(0, loct); - gpxRouteDirections.addAll(0, dt); - for(int i = dt.size() ; i < gpxRouteDirections.size(); i++ ) { - gpxRouteDirections.get(i).routePointOffset += loct.size(); + if (gpxRouteDirections != null) { + gpxRouteDirections.addAll(0, dt); + for (int i = dt.size(); i < gpxRouteDirections.size(); i++) { + gpxRouteDirections.get(i).routePointOffset += loct.size(); + } } } }