Skip to content

Commit

Permalink
Additional checks to prevent errors during atypical use
Browse files Browse the repository at this point in the history
  • Loading branch information
modos189 committed Apr 28, 2019
1 parent ce470b9 commit 419b1ab
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/plugin/leaflet.canvas-markers.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ function layerFactory(L) {
);
},
_searchPoints: function (point) {
return this._markers.search({ minX: point.x, minY: point.y, maxX: point.x, maxY: point.y });
if (this._markers)
return this._markers.search({ minX: point.x, minY: point.y, maxX: point.x, maxY: point.y });
},
on: function (event, func) {
var self = this;
Expand Down Expand Up @@ -529,8 +530,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);
Expand Down

0 comments on commit 419b1ab

Please sign in to comment.