diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java index b3fbc3d203..e1425c0478 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapRouteInfoMenu.java @@ -649,9 +649,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener { mapActivity.getString(R.string.shared_string_address) + mapActivity.getString(R.string.shared_string_ellipsis))); TargetPoint start = getTargets().getPointToStart(); + int startPos = -1; if (start != null) { String oname = start.getOnlyName().length() > 0 ? start.getOnlyName() : (mapActivity.getString(R.string.route_descr_map_location) + " " + getRoutePointDescription(start.getLatitude(), start.getLongitude())); + startPos = fromActions.size(); fromActions.add(new RouteSpinnerRow(SPINNER_START_ID, R.drawable.ic_action_get_my_location, oname)); final LatLon latLon = start.point; @@ -677,7 +679,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener { fromAdapter.addAll(fromActions); fromSpinner.setAdapter(fromAdapter); if (start != null) { - fromSpinner.setSelection(fromActions.size() - 1); + fromSpinner.setSelection(startPos); } else { if (mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation() == null) { fromSpinner.setPromptId(R.string.search_poi_location); diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java index ea0c19fb46..d8316c1448 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/MapMarkerSelectionFragment.java @@ -58,15 +58,17 @@ public class MapMarkerSelectionFragment extends BaseOsmAndDialogFragment { screenOrientation = DashLocationFragment.getScreenOrientation(mapActivity); MapViewTrackingUtilities trackingUtils = mapActivity.getMapViewTrackingUtilities(); - float head = trackingUtils.getHeading(); - float mapRotation = mapActivity.getMapRotate(); - LatLon mw = mapActivity.getMapLocation(); - Location l = trackingUtils.getMyLocation(); - boolean mapLinked = trackingUtils.isMapLinkedToLocation() && l != null; - LatLon myLoc = l == null ? null : new LatLon(l.getLatitude(), l.getLongitude()); - useCenter = !mapLinked; - loc = (useCenter ? mw : myLoc); - heading = useCenter ? -mapRotation : head; + if (trackingUtils != null) { + float head = trackingUtils.getHeading(); + float mapRotation = mapActivity.getMapRotate(); + LatLon mw = mapActivity.getMapLocation(); + Location l = trackingUtils.getMyLocation(); + boolean mapLinked = trackingUtils.isMapLinkedToLocation() && l != null; + LatLon myLoc = l == null ? null : new LatLon(l.getLatitude(), l.getLongitude()); + useCenter = !mapLinked; + loc = (useCenter ? mw : myLoc); + heading = useCenter ? -mapRotation : head; + } } nightMode = !app.getSettings().isLightContent();