Add back HeatLayer._map reference check

In some situation, the property is undefined, given the call is async,
and we can add/remove the layer during the async stack
This commit is contained in:
Yohan Boniface 2023-10-12 11:06:14 +02:00
parent 5f9d7d3ec3
commit 1e8c51b0e5

View file

@ -374,6 +374,14 @@ L.U.Layer.Heat = L.HeatLayer.extend({
this._updateOptions()
},
redraw: function () {
// setlalngs call _redraw through setAnimFrame, thus async, so this
// can ends with race condition if we remove the layer very faslty after.
// TODO: PR in upstream Leaflet.heat
if (!this._map) return
L.HeatLayer.prototype.redraw.call(this)
},
_redraw: function () {
// Import patch from https://github.com/Leaflet/Leaflet.heat/pull/78
// Remove me when this get merged and released.