mapbox / mapbox/mapbox-navigation-android

java.lang.String java.lang.CharSequence.toString()' on a null object reference ThemeSwitcher

Open
#3,873 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs more information UI
Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

**Android API: 29**
**Mapbox Navigation SDK version:5.7.0**

### Steps to trigger behavior

1. init navigation turn by turn navigation

### Expected behavior

### Actual behavior

java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference
at com.mapbox.navigation.ui.internal.ThemeSwitcher.retrieveMapStyle(ThemeSwitcher.java:97)
at com.mapbox.navigation.ui.NavigationView.onMapReady(NavigationView.java:239)
at com.mapbox.mapboxsdk.maps.MapView$MapCallback.onMapReady(MapView.java:1320)
at com.mapbox.mapboxsdk.maps.MapView$MapCallback.initialised(MapView.java:1306)
at com.mapbox.mapboxsdk.maps.MapView.initialiseMap(MapView.java:197)
at com.mapbox.mapboxsdk.maps.MapView.access$800(MapView.java:63)
at com.mapbox.mapboxsdk.maps.MapView$6.run(MapView.java:353)
at android.os.Handler.handleCallback(Handler.java:790)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6626)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811)

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 in ThemeSwitcher.java at line 97, where retrieveMapStyle is called during NavigationView.onMapReady. Reproduce the crash by initializing turn-by-turn navigation on Android API 29 with Mapbox Navigation SDK 5.7.0, then trace the null CharSequence. Done means initialization no longer throws this NullPointerException.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.