-
-
Notifications
You must be signed in to change notification settings - Fork 815
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
fixed crash in android, layer not added in maps with 3D themes #3450
base: main
Are you sure you want to change the base?
Conversation
@ignaciotcrespo thanks much for the PR, can you please add a simple standalone component reproducing the issue, thanks? |
hi @mfazekas it occurs exclusively on a client-specific map, which I cannot share due to proprietary restrictions. |
@@ -217,7 +216,11 @@ abstract class RNMBXLayer<T : Layer?>(protected var mContext: Context) : Abstrac | |||
} | |||
val layer = mLayer ?: return | |||
val mapView = mMapView ?: return | |||
style.addLayerAt(layer, index) | |||
if(index < 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the index negative? Is this because the above line index = layerSize -1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for checking it, indeed, it is adding at index 0 a layer but there are no layers present in the style yet, causing a -1 index
Description
Using 3D themes in mapbox causes a crash in android devices. The layer index is not calculated correctly and can not be added.
The fix is to add a new layer when the calculated index is negative.
Checklist
CONTRIBUTING.md
yarn generate
in the root folder/example
app./example
)Screenshot OR Video
Component to reprocuce the issue you're fixing