From 4d52d027e0678dd7639ccde5fad3e73b5651fdcf Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Thu, 28 Apr 2016 18:19:53 +0300 Subject: [PATCH] Fixed NPE. --- OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java | 2 +- OsmAnd/src/net/osmand/plus/views/POIMapLayer.java | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java index 3c8105de92..93232f3aae 100644 --- a/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java +++ b/OsmAnd/src/net/osmand/plus/dialogs/ConfigureMapMenu.java @@ -220,7 +220,7 @@ public class ConfigureMapMenu { selected = settings.SELECTED_POI_FILTER_FOR_MAP.get() != null; adapter.addItem(new ContextMenuItem.ItemBuilder() .setTitleId(R.string.layer_poi, activity) - .setSelected(settings.SELECTED_POI_FILTER_FOR_MAP.get() != null) + .setSelected(selected) .setDescription(POIMapLayer.getSelectedPoiName(app)) .setColor(selected ? R.color.osmand_orange : ContextMenuItem.INVALID_ID) .setIcon(R.drawable.ic_action_info_dark) diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 47ea75b2a0..4015ce555c 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -322,7 +322,11 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon return app.getResources().getString(R.string.shared_string_none); } PoiUIFilter filter = pfh.getFilterById(filterId); - return filter.getName(); + if (filter == null) { + return app.getResources().getString(R.string.shared_string_none); + } else { + return filter.getName(); + } } static int getResIdFromAttribute(final Context ctx, final int attr) {