Fix context menu npe

This commit is contained in:
Alexey Kulish 2017-10-23 13:55:16 +03:00
parent 7277f72b7a
commit 0294dd8c45

View file

@ -574,7 +574,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
} }
private void restoreCustomMapRatio() { private void restoreCustomMapRatio() {
if (map.hasCustomMapRatio()) { if (map != null && map.hasCustomMapRatio()) {
map.restoreMapRatio(); map.restoreMapRatio();
} }
} }
@ -881,6 +881,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
public void onPause() { public void onPause() {
restoreCustomMapRatio(); restoreCustomMapRatio();
if (view != null) {
ViewParent parent = view.getParent(); ViewParent parent = view.getParent();
if (parent != null && containerLayoutListener != null) { if (parent != null && containerLayoutListener != null) {
((View) parent).removeOnLayoutChangeListener(containerLayoutListener); ((View) parent).removeOnLayoutChangeListener(containerLayoutListener);
@ -891,6 +892,7 @@ public class MapContextMenuFragment extends Fragment implements DownloadEvents {
getMapActivity().enableDrawer(); getMapActivity().enableDrawer();
} }
menu.updateControlsVisibility(false); menu.updateControlsVisibility(false);
}
super.onPause(); super.onPause();
} }