diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java index cd035da4bb..3fe1e4452b 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenu.java @@ -651,7 +651,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL } private void updateTitle(String address) { - nameStr = address; + setNameStr(address); getPointDescription().setName(address); WeakReference fragmentRef = findMenuFragment(); if (fragmentRef != null) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index 51e7370da6..2c6666e925 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -1369,7 +1369,9 @@ public class MenuBuilder { if (amenity != null) { PoiCategory category = amenity.getType(); PoiType poiType = category.getPoiTypeByKeyName(amenity.getSubType()); - return app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + poiType.getKeyName()); + if (poiType != null) { + return app.getPoiFilters().getFilterById(PoiUIFilter.STD_PREFIX + poiType.getKeyName()); + } } return null; } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java index f676c5812e..722e09c27d 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuTitleController.java @@ -138,6 +138,10 @@ public abstract class MenuTitleController { } } + public void setNameStr(@Nullable String nameStr) { + this.nameStr = nameStr != null ? nameStr : ""; + } + protected boolean needStreetName() { MenuController menuController = getMenuController(); boolean res = getObject() != null || Algorithms.isEmpty(getPointDescription().getName()); @@ -165,28 +169,28 @@ public abstract class MenuTitleController { protected void acquireNameAndType() { String firstNameStr = ""; - nameStr = ""; typeStr = ""; commonTypeStr = ""; streetStr = ""; + setNameStr(""); MenuController menuController = getMenuController(); if (menuController != null) { firstNameStr = menuController.getFirstNameStr(); - nameStr = menuController.getNameStr(); + setNameStr(menuController.getNameStr()); typeStr = menuController.getTypeStr(); commonTypeStr = menuController.getCommonTypeStr(); } if (Algorithms.isEmpty(nameStr)) { - nameStr = typeStr; + setNameStr(typeStr); typeStr = commonTypeStr; } else if (Algorithms.isEmpty(typeStr)) { typeStr = commonTypeStr; } if (!Algorithms.isEmpty(firstNameStr)) { - nameStr = firstNameStr + " (" + nameStr + ")"; + setNameStr(firstNameStr + " (" + nameStr + ")"); } } @@ -204,7 +208,7 @@ public abstract class MenuTitleController { } if (displayStreetNameInTitle()) { - nameStr = streetStr; + setNameStr(streetStr); getPointDescription().setName(nameStr); } onSearchAddressDone();