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

[BUG] Adding an existing source causes app to crash #512

Open
albertmoravec opened this issue Oct 15, 2024 · 3 comments
Open

[BUG] Adding an existing source causes app to crash #512

albertmoravec opened this issue Oct 15, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@albertmoravec
Copy link

Platforms

iOS

Version of flutter maplibre_gl

0.20.0

Bug Description

Calling controller.addSource() more than once for the same source causes app crash on iOS with MLNRedundantSourceIdentifierException.

Steps to Reproduce

  1. Call controller.addSource('123', VectorSourceProperties(...)).
  2. Call controller.addSource('123', VectorSourceProperties(...)) again with the same ID.

Expected Results

Exception should be returned.

Actual Results

App completely crashes with MLNRedundantSourceIdentifierException, not providing any option to handle the exception.

Code Sample

await controller.addSource('123', VectorSourceProperties());
await controller.addSource('123', VectorSourceProperties());
@albertmoravec albertmoravec added the bug Something isn't working label Oct 15, 2024
@albertmoravec
Copy link
Author

Not sure if this can be fixed from Swift side, so I opened an issue on MapLibre Native.

@danieljosua1
Copy link
Contributor

@albertmoravec I’ve also run into this issue multiple times – the same problem also occurs on Android

@Rossdex
Copy link

Rossdex commented Oct 24, 2024

This was also an issue on the mapbox version of this plugin, any platform exceptions cause a full on app crash.

The solution I have been working with is to keep track of which layers you have added to your map in a provider and remove the layer and re-add with the new data. It's not ideal but it works and the performance hit isn't huge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants