You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're currently experiencing crashes in our app coming from a NullPointerException thats being thrown in the ManeuverView:
java.lang.NullPointerException: Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference
at java.lang.String.contains(String.java:2722)
at com.mapbox.services.android.navigation.ui.v5.instruction.maneuver.ManeuverView.onDraw(ManeuverView.java:243)
Which happens right here in the contains(maneuverModifier)
if (STEP_MANEUVER_MODIFIER_LEFT.equals(drivingSide) && STEP_MANEUVER_MODIFIER_UTURN.contains(maneuverModifier)) {
The Problem we're facing is, that when the drivingSide is "left" and the maneuverModifier is null the contains() call will crash as it tries to call toString() on null.
The banner instructions we get from our routing engine for the type "arrive" do not contain a modifier attribute. They look something like this:
[
{
"primary": {
"text": "You have arrived at your Destination.",
"type": "arrive",
"components": [
{
"text": "You have arrived at your Destination.",
"type": "text"
}
]
},
"distanceAlongGeometry": ...
}
]
Now, I believe that the ManeuverView should be able to handle the maneuverModifier being null (most of the code hints at this being the case), just this one call is not able to handle a null parameter.
Am I correct that this STEP_MANEUVER_MODIFIER_UTURN.contains(maneuverModifier) should actually be a STEP_MANEUVER_MODIFIER_UTURN.equals(maneuverModifier) as that would be handling the parameter being null?
I will also open a PR for this that should fix it based on my assumption. So please correct me if I am wrong and I will adjust the PR accordingly.
The text was updated successfully, but these errors were encountered:
Android API:
Maplibre Navigation SDK version:
We're currently experiencing crashes in our app coming from a
NullPointerException
thats being thrown in theManeuverView
:Which happens right here in the
contains(maneuverModifier)
maplibre-navigation-android/libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/maneuver/ManeuverView.java
Line 243 in 1c8b043
The Problem we're facing is, that when the
drivingSide
is "left" and themaneuverModifier
isnull
thecontains()
call will crash as it tries to calltoString()
onnull
.The banner instructions we get from our routing engine for the type "arrive" do not contain a
modifier
attribute. They look something like this:Now, I believe that the
ManeuverView
should be able to handle themaneuverModifier
beingnull
(most of the code hints at this being the case), just this one call is not able to handle anull
parameter.Am I correct that this
STEP_MANEUVER_MODIFIER_UTURN.contains(maneuverModifier)
should actually be aSTEP_MANEUVER_MODIFIER_UTURN.equals(maneuverModifier)
as that would be handling the parameter being null?I will also open a PR for this that should fix it based on my assumption. So please correct me if I am wrong and I will adjust the PR accordingly.
The text was updated successfully, but these errors were encountered: