Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed an issue where remaining waypoints would always return 0 and break reroute handling #3972

Merged
merged 1 commit into from
Feb 10, 2021

Conversation

LukasPaczos
Copy link
Member

Description

Fixes a regression from 769430a which caused a crash when a reroute event happens due to a misreported remaining waypoints count, example stacktrace:

Process: com.mapbox.navigation.instrumentation_tests, PID: 15480
    java.lang.IllegalStateException: At least 2 coordinates should be provided.
        at com.mapbox.navigation.route.offboard.router.MapboxDirectionsUtilsKt.routeOptions(MapboxDirectionsUtils.kt:20)
        at com.mapbox.navigation.route.internal.offboard.MapboxOffboardRouter.getRoute(MapboxOffboardRouter.kt:53)
        at com.mapbox.navigation.route.internal.hybrid.MapboxHybridRouter$RouterHandler.handleRouteRequest(MapboxHybridRouter.kt:182)
        at com.mapbox.navigation.route.internal.hybrid.MapboxHybridRouter$RouterHandler.getRoute(MapboxHybridRouter.kt:160)
        at com.mapbox.navigation.route.internal.hybrid.MapboxHybridRouter.getRoute(MapboxHybridRouter.kt:205)
        at com.mapbox.navigation.core.directions.session.MapboxDirectionsSession.requestRoutes(MapboxDirectionsSession.kt:81)
        at com.mapbox.navigation.core.reroute.MapboxRerouteController.request(MapboxRerouteController.kt:101)
        at com.mapbox.navigation.core.reroute.MapboxRerouteController.reroute(MapboxRerouteController.kt:58)
        at com.mapbox.navigation.core.MapboxNavigation.reroute(MapboxNavigation.kt:738)
        at com.mapbox.navigation.core.MapboxNavigation.access$reroute(MapboxNavigation.kt:129)
        at com.mapbox.navigation.core.MapboxNavigation$createInternalOffRouteObserver$1.onOffRouteStateChanged(MapboxNavigation.kt:732)
        at com.mapbox.navigation.core.trip.session.MapboxTripSession.setOffRoute(MapboxTripSession.kt:123)
        at com.mapbox.navigation.core.trip.session.MapboxTripSession.access$setOffRoute$p(MapboxTripSession.kt:48)
        at com.mapbox.navigation.core.trip.session.MapboxTripSession$updateDataFromNavigatorStatus$updateNavigatorStatusDataJob$1.invokeSuspend(MapboxTripSession.kt:487)
        at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
        at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
        at android.os.Handler.handleCallback(Handler.java:883)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at androidx.test.espresso.base.Interrogator.loopAndInterrogate(Interrogator.java:148)
        at androidx.test.espresso.base.UiControllerImpl.loopUntil(UiControllerImpl.java:519)
        at androidx.test.espresso.base.UiControllerImpl.loopMainThreadUntilIdle(UiControllerImpl.java:441)

This PR resolves the issue by checking the coordinates count instead of waypoints indices count which reports a different value and adds an instrumentation regression test.

Changelog

<changelog>Fixed a crash when rerouting and fixed a misreported remaining waypoints count that was the root cause.</changelog>

@LukasPaczos LukasPaczos added the Core Work related to core navigation and integrations. label Feb 10, 2021
@LukasPaczos LukasPaczos added this to the v2.0.0 (Public Preview) milestone Feb 10, 2021
@LukasPaczos LukasPaczos requested a review from a team February 10, 2021 12:39
Copy link
Contributor

@korshaknn korshaknn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just some nits

@LukasPaczos LukasPaczos force-pushed the lp-offroute-remaining-waypoints branch 3 times, most recently from 7437dc6 to b701060 Compare February 10, 2021 13:40
@LukasPaczos LukasPaczos force-pushed the lp-offroute-remaining-waypoints branch from b701060 to 861e9fc Compare February 10, 2021 13:42
@LukasPaczos LukasPaczos merged commit 56aaf8c into main Feb 10, 2021
@LukasPaczos LukasPaczos deleted the lp-offroute-remaining-waypoints branch February 10, 2021 15:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Work related to core navigation and integrations.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants