From a79109d31174c32fa997e86f9ad29963dca55244 Mon Sep 17 00:00:00 2001 From: Alexander Danilov Date: Sun, 28 Apr 2019 22:46:52 +0300 Subject: [PATCH] Additional checks to prevent errors during atypical use --- src/plugin/leaflet.canvas-markers.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/plugin/leaflet.canvas-markers.js b/src/plugin/leaflet.canvas-markers.js index 315f50d..f834d89 100644 --- a/src/plugin/leaflet.canvas-markers.js +++ b/src/plugin/leaflet.canvas-markers.js @@ -529,8 +529,10 @@ function layerFactory(L) { }, _removeGeneric: function (val, compareFn) { - this._latlngMarkers.remove(val, compareFn); - this._latlngMarkers.total--; + if (this._latlngMarkers) { + this._latlngMarkers.remove(val, compareFn); + this._latlngMarkers.total--; + } }, addTo: function (map) { map.addLayer(this);