Leaflet: Bugfix #6025 introduces exception in GridLayer._tileReady - a parameter check is missing

Created on 20 Jul 2018  路  5Comments  路  Source: Leaflet/Leaflet

Leaflet 1.3.2/1.3.3 has a fix that does not check a parameter for null/undefined and crashes in my scenario because GridLayer._tileReady(coords, err, tile) gets called with tile = null.

By fix #6025 GridLayer.js line 845 is changed to:
if (!this._map || tile.getAttribute('src') === Util.emptyImageUrl) { return; }
but tile is not checked.
I propose fixing this by
if (!this._map || (tile && tile.getAttribute('src') === Util.emptyImageUrl)) { return; }

I fear I can't give a fiddle because I have a complicated scenario involving a subclassed leaflet.vectorgrid. The code worked fine with Leaflet 1.3.1 that didn't have the second condition in the if statement.

Most helpful comment

I concur with this, same situation, running Leaflet 1.3.3 with Leaflet.VectorGrid.

Works fine in 1.3.1 and 1.2.0

All 5 comments

I concur with this, same situation, running Leaflet 1.3.3 with Leaflet.VectorGrid.

Works fine in 1.3.1 and 1.2.0

Same problem here in combination with the leaflet plugin "Leaflet.TileLayer.PouchDBCached"

Any idea if there will be a release soon incorporating this fix?

Finally find this.. expect for next release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JonnyBGod picture JonnyBGod  路  4Comments

jblarsen picture jblarsen  路  3Comments

gdbd picture gdbd  路  3Comments

onethread picture onethread  路  3Comments

prbaron picture prbaron  路  3Comments