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
{{ message }}
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
val startLatLng = LatLng(startingLocation.latitude,startingLocation.longitude)
val endingLatLng = LatLng(endingLocation.latitude, endingLocation.longitude)
mapboxMap.addMarker(MarkerOptions().position(startLatLng))
mapboxMap.addMarker(MarkerOptions().position(endingLatLng))
val latLngBounds = LatLngBounds.Builder()
.include(startLatLng)
.include(endingLatLng)
.build()
val cameraUpdate = CameraUpdateFactory.newLatLngBounds(latLngBounds,
resources.getDimensionPixelSize(R.dimen.margin_padding_normal))
Animate Camera
mapboxMap.animateCamera(cameraUpdate, 1000)
Expected behavior
Map will be animated and zoomed to LatLngBounds
Actual behavior
Map error: java.lang.NullPointerException: Attempt to read from field 'com.mapbox.mapboxsdk.geometry.LatLng com.mapbox.mapboxsdk.camera.CameraPosition.target' on a null object reference
The text was updated successfully, but these errors were encountered:
Thanks for reporting the issue @tan-tran-ea. CameraBoundsUpdate is the only update that doesn't invalidate camera before executing which results in said NPE, that's caught, but will escape the rest of the code block regardless.
Closing as the issue is already fixed with the upcoming 6.0.0, but I will add additional camera invalidation to the initialization process.
Platform: Android + Kotlin
Mapbox SDK version: 5.5.1
Steps to trigger behavior
Load map Async
Create LatLngBounds with 2 locations:
Animate Camera
mapboxMap.animateCamera(cameraUpdate, 1000)
Expected behavior
Map will be animated and zoomed to LatLngBounds
Actual behavior
Map error:
java.lang.NullPointerException: Attempt to read from field 'com.mapbox.mapboxsdk.geometry.LatLng com.mapbox.mapboxsdk.camera.CameraPosition.target' on a null object reference
The text was updated successfully, but these errors were encountered: