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

Don't attempt to clear "undefined" sources #3903

Conversation

AndyMoreland
Copy link
Contributor

When I upgraded from mapbox 0.28.0 to 0.30.0 I noticed that when my application tried to "update" a background-type layer I got an NPE. The root cause seems to be that when a background layer is removed-and-added in a single batched style update group its source gets marked for "clear"-ing.

This sucks because layer.source === undefined for background layers, and when style.js#283 attempts to call _clearSource on undefined it throws an exception.

If layers without sources (e.g. a 'background' layer) are
removed-and-re-added in a single style update batch, we
previously attempted to clear their source. This results in
an NPE that crashes the application.
jfirebaugh added a commit to mapbox/mapbox-gl-test-suite that referenced this pull request Jan 7, 2017
@jfirebaugh jfirebaugh merged commit 89244c7 into mapbox:master Jan 7, 2017
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.

2 participants