mapbox / mapbox/mapbox-navigation-android

IndexOutOfBound crash in optimization api use

Open
#3,449 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

archived
Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

I am trying to use Optimization api - https://docs.mapbox.com/android/java/overview/optimization/

I am getting following crash in this :

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
        at java.util.ArrayList.get(ArrayList.java:437)
        at com.mapbox.services.android.navigation.ui.v5.route.MapRouteLine.buildWayPointFeatureFromLeg(MapRouteLine.java:359)
        at com.mapbox.services.android.navigation.ui.v5.route.MapRouteLine.buildWayPointFeatureCollectionFrom(MapRouteLine.java:351)
        at com.mapbox.services.android.navigation.ui.v5.route.MapRouteLine.drawWayPoints(MapRouteLine.java:345)
        at com.mapbox.services.android.navigation.ui.v5.route.MapRouteLine.access$300(MapRouteLine.java:45)
        at com.mapbox.services.android.navigation.ui.v5.route.MapRouteLine$1.onRouteFeaturesProcessed(MapRouteLine.java:331)
        at com.mapbox.services.android.navigation.ui.v5.route.FeatureProcessingTask$1.run(FeatureProcessingTask.java:65)
        at android.os.Handler.handleCallback(Handler.java:888)
        at android.os.Handler.dispatchMessage(Handler.java:100)
        at android.os.Looper.loop(Looper.java:213)
        at android.app.ActivityThread.main(ActivityThread.java:8178)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:513)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1101)

Android API:
Mapbox Navigation SDK version: 0.42.6

Sample code : https://drive.google.com/file/d/1VZVjlSWWV2qEJ_WUaiJCCg5dT5aLSxMp/view?usp=sharing

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with MapRouteLine.java around lines 345-359 in the stack trace, then trace the call from FeatureProcessingTask.java. Reproduce the crash using the linked optimization API sample with Navigation SDK 0.42.6. Done means the optimization route no longer throws IndexOutOfBoundsException while drawing waypoints.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.