Fix crash

This commit is contained in:
PavelRatushny 2017-10-30 16:50:50 +02:00
parent b81cfec13c
commit 90566c4fbd

View file

@ -872,7 +872,7 @@ public class MeasurementToolFragment extends Fragment {
private void cancelModes() { private void cancelModes() {
if (editingCtx.getOriginalPointToMove() != null) { if (editingCtx.getOriginalPointToMove() != null) {
cancelMovePointMode(); cancelMovePointMode();
} else if (editingCtx.getSelectedPointPosition() != -1) { } else if (!isSelectedPointMenuOpened() && editingCtx.getSelectedPointPosition() != -1) {
cancelAddPointBeforeOrAfterMode(); cancelAddPointBeforeOrAfterMode();
} }
} }
@ -1477,6 +1477,15 @@ public class MeasurementToolFragment extends Fragment {
} }
} }
private boolean isSelectedPointMenuOpened() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
Fragment fragment = mapActivity.getSupportFragmentManager().findFragmentByTag(SelectedPointBottomSheetDialogFragment.TAG);
return fragment != null;
}
return false;
}
public static boolean showInstance(FragmentManager fragmentManager, MeasurementEditingContext editingCtx) { public static boolean showInstance(FragmentManager fragmentManager, MeasurementEditingContext editingCtx) {
try { try {
MeasurementToolFragment fragment = new MeasurementToolFragment(); MeasurementToolFragment fragment = new MeasurementToolFragment();