diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index a1eda21f8c..88b9a9275e 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -609,6 +609,10 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven enableDrawer(); } + public boolean isActivityDestroyed() { + return mIsDestroyed; + } + private void restartApp() { AlertDialog.Builder bld = new AlertDialog.Builder(this); bld.setMessage(R.string.storage_permission_restart_is_required); diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java index d5ec9e66b0..e7003b708c 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MapContextMenuFragment.java @@ -1104,7 +1104,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents { final boolean centered) { try { - if (menu.getLatLon() == null) { + if (menu.getLatLon() == null || mapActivity.isActivityDestroyed()) { return false; } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java index 3429bb850b..d34d87e804 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/other/MapMultiSelectionMenuFragment.java @@ -100,6 +100,11 @@ public class MapMultiSelectionMenuFragment extends Fragment implements AdapterVi } public static void showInstance(final MapActivity mapActivity) { + + if (mapActivity.isActivityDestroyed()) { + return; + } + MapMultiSelectionMenu menu = mapActivity.getContextMenu().getMultiSelectionMenu(); int slideInAnim = menu.getSlideInAnimation();