forked from organicmaps/organicmaps
[android] Fix NPE in MwmActivity.showStartPointNotice()
Reproduces when the back and start buttons are pressed at the same time. Fixes #6628 Signed-off-by: Roman Tsisyk <roman@tsisyk.com>
This commit is contained in:
parent
a295b7a8b2
commit
58e99345a2
3 changed files with 12 additions and 2 deletions
|
@ -1674,6 +1674,9 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
{
|
||||
final RoutingController controller = RoutingController.get();
|
||||
|
||||
if (showAddStartOrFinishFrame(controller, true))
|
||||
return false;
|
||||
|
||||
// Starting and ending points must be non-null, see {@link #showAddStartOrFinishFrame() }.
|
||||
final MapObject startPoint = Objects.requireNonNull(controller.getStartPoint());
|
||||
if (startPoint.isMyPosition())
|
||||
|
@ -1705,7 +1708,7 @@ public class MwmActivity extends BaseMwmFragmentActivity
|
|||
Logger.d(LOCATION_TAG, "newMode = " + LocationState.nameOf(newMode));
|
||||
mMapButtonsViewModel.setMyPositionMode(newMode);
|
||||
RoutingController controller = RoutingController.get();
|
||||
if (controller.isPlanning())
|
||||
if (controller.isPlanning() || controller.isBuilding() || controller.isErrorEncountered())
|
||||
showAddStartOrFinishFrame(controller, true);
|
||||
|
||||
if (newMode == FOLLOW || newMode == FOLLOW_AND_ROTATE)
|
||||
|
|
|
@ -284,7 +284,10 @@ final class RoutingBottomMenuController implements View.OnClickListener
|
|||
{
|
||||
mStart.setText(mContext.getText(R.string.p2p_start));
|
||||
mStart.setOnClickListener(v -> {
|
||||
if (mListener != null)
|
||||
// Ignore the event if the back and start buttons are pressed at the same time.
|
||||
// See {@link #RoutingPlanController.onUpClick()}.
|
||||
// https://github.com/organicmaps/organicmaps/issues/6628
|
||||
if (mListener != null && RoutingController.get().isPlanning())
|
||||
mListener.onRoutingStart();
|
||||
});
|
||||
}
|
||||
|
|
|
@ -165,6 +165,10 @@ public class RoutingPlanController extends ToolbarController
|
|||
@Override
|
||||
public void onUpClick()
|
||||
{
|
||||
// Ignore the event if the back and start buttons are pressed at the same time.
|
||||
// See {@link #RoutingBottomMenuController.setStartButton()}.
|
||||
if (RoutingController.get().isNavigating())
|
||||
return;
|
||||
RoutingController.get().cancel();
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue