diff --git a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java index 8065e331a0..d4b5b32cfb 100644 --- a/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java +++ b/OsmAnd/src/net/osmand/plus/ContextMenuAdapter.java @@ -111,6 +111,12 @@ public class ContextMenuAdapter { mIconsCache = app.getIconsCache(); } + @Override + public boolean isEnabled(int position) { + final ContextMenuItem item = getItem(position); + return item != null && item.getItemClickListener() != null; + } + @Override public View getView(final int position, View convertView, ViewGroup parent) { // User super class to create the View diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index efaa39a4ab..7d9fe155cc 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -860,7 +860,7 @@ public class MapActivityActions implements DialogProvider { public void onItemClick(AdapterView parent, View view, int position, long id) { ContextMenuItem item = contextMenuAdapter.getItem(position); ContextMenuAdapter.ItemClickListener click = item.getItemClickListener(); - if (click.onContextMenuClick(simpleListAdapter, item.getTitleId(), + if (click != null && click.onContextMenuClick(simpleListAdapter, item.getTitleId(), position, false)) { mapActivity.closeDrawer(); }