Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ignaciotcrespo
Copy link

@ignaciotcrespo ignaciotcrespo commented Apr 11, 2024

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

  • I've read CONTRIBUTING.md
  • I updated the doc/other generated code with running yarn generate in the root folder
  • I have tested the new feature on /example app.
    • In V11 mode/ios
    • In New Architecture mode/ios
    • In V11 mode/android
    • In New Architecture mode/android
  • I added/updated a sample - if a new feature was implemented (/example)

Screenshot OR Video

Component to reprocuce the issue you're fixing

@mfazekas
Copy link
Contributor

@ignaciotcrespo thanks much for the PR, can you please add a simple standalone component reproducing the issue, thanks?

@ignaciotcrespo
Copy link
Author

@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) {
Copy link
Contributor

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

Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants