Closed tylergaw closed 4 years ago
Thanks for reporting this. The regression was traced back to commit https://github.com/mapbox/mapbox-gl-js/commit/fa3616825411009284b99daae7f27368fad774af, specifically https://github.com/mapbox/mapbox-gl-js/commit/fa3616825411009284b99daae7f27368fad774af#diff-75421c871234afa60c44391b9c0ef05aR21.
cc @mourner
mapbox-gl-js version:
1.9.1
This issue showed up first in
1.9.0
. It's not in versions1.7.x
and1.8.x
browser:
Steps to Trigger Behavior
z11
Link to Demonstration
The issue occurs on the public style page as well as in other implementations. Both available here in case one is easier to use than the other.
Expected Behavior
Actual Behavior
Details
This is happening here https://github.com/mapbox/mapbox-gl-js/blob/844ea8dc0e62930f748c91e2930444edcb75eb4d/src/render/painter.js#L514
It's possible for
image.from
to benull
. So thetoString()
invocation throws as expected.Getting to the scenario is pretty specific. In a style, you have to have a layer with a background pattern that changes from
None
to any pattern. In the shared style above that is thebackground-texture
layer. It looks like this:From z0 to z11 There's no Pattern set. Then at
z11
we apply thebackground-texture
image as a pattern.Workaround
To get around this for now we've updated the layer style to not toggle the pattern off/on. Instead, we always have the background-texture pattern applied and update the layer opacity to hide it.
opacity:
That works for now, but it seems like
isPatternMissing
needs a bit more guarding to protect against invokingtoString
onnull
objects.