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

Prevent route overview animation with insufficient route data #1120

Merged
merged 1 commit into from
Jul 19, 2018

Conversation

danesfeder
Copy link
Contributor

Uncaught 🐛 from #950 found in CI:

07-18 19:30:48.337 30794-30794/com.mapbox.services.android.navigation.testapp E/AndroidRuntime: FATAL EXCEPTION: main
    Process: com.mapbox.services.android.navigation.testapp, PID: 30794
    com.mapbox.mapboxsdk.exceptions.InvalidLatLngBoundsException: Cannot create a LatLngBounds from 1 items
        at com.mapbox.mapboxsdk.geometry.LatLngBounds$Builder.build(LatLngBounds.java:704)
        at com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera.convertRoutePointsToLatLngBounds(NavigationCamera.java:331)
        at com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera.buildOverviewCameraUpdate(NavigationCamera.java:318)
        at com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera.animateMapboxMapForRouteOverview(NavigationCamera.java:304)
        at com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera.animateCameraForRouteOverview(NavigationCamera.java:299)
        at com.mapbox.services.android.navigation.ui.v5.camera.NavigationCamera.showRouteOverview(NavigationCamera.java:167)
        at com.mapbox.services.android.navigation.ui.v5.map.NavigationMapboxMap.showRouteOverview(NavigationMapboxMap.java:123)
        at com.mapbox.services.android.navigation.ui.v5.NavigationView.updateCameraRouteOverview(NavigationView.java:347)
        at com.mapbox.services.android.navigation.ui.v5.NavigationPresenter.onRouteOverviewClick(NavigationPresenter.java:81)
        at com.mapbox.services.android.navigation.ui.v5.RouteOverviewBtnClickListener.onClick(RouteOverviewBtnClickListener.java:15)
        at android.view.View.performClick(View.java:5198)
        at android.view.View$PerformClick.run(View.java:21147)
        at android.os.Handler.handleCallback(Handler.java:739)
        at android.os.Handler.dispatchMessage(Handler.java:95)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:5417)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

@danesfeder danesfeder added bug Defect to be fixed. navigation-ui labels Jul 18, 2018
@danesfeder danesfeder added this to the 0.16.0 milestone Jul 18, 2018
@danesfeder danesfeder self-assigned this Jul 18, 2018
Copy link
Contributor

@Guardiola31337 Guardiola31337 left a comment

Choose a reason for hiding this comment

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

Good catch Firebase Test Lab Robo Test 😂

Thanks @danesfeder for patching it :shipit:

final CameraUpdate overviewUpdate = buildOverviewCameraUpdate(padding, routePoints);
CameraUpdate resetUpdate = buildResetCameraUpdate();
Copy link
Contributor

Choose a reason for hiding this comment

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

NIT - Why did we change the order?

final CameraUpdate overviewUpdate = buildOverviewCameraUpdate(padding, routePoints);
CameraUpdate resetUpdate = buildResetCameraUpdate();

vs

CameraUpdate resetUpdate = buildResetCameraUpdate();
final CameraUpdate overviewUpdate = buildOverviewCameraUpdate(padding, routePoints);

Declare variables as close to their usage as possible.

From Clean Code ☝️

@danesfeder danesfeder force-pushed the dan-overview-bounds-bug branch 2 times, most recently from bba2ace to 04a7418 Compare July 19, 2018 15:39
@danesfeder danesfeder merged commit 0d4c26f into master Jul 19, 2018
@danesfeder danesfeder deleted the dan-overview-bounds-bug branch July 19, 2018 16:00
@danesfeder danesfeder mentioned this pull request Jul 20, 2018
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Defect to be fixed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants