Skip to content

Commit

Permalink
fix exception in mouse event handler with empty CanvasMarkerLayer
Browse files Browse the repository at this point in the history
`this._markers` is undefined in `_searchPoints`, called from `_onMouseMove`
Could be fixed in some another place:
e.g. check `_markers` in `_searchPoints`
 ...or initialize (empty) `_markers` on CanvasMarkerLayer init
 ...or do not attach listeners until we have markers
 ...or check markers existence in the beginning of listener
  • Loading branch information
johndoe committed May 6, 2019
1 parent 5b67c61 commit ad96df0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/plugin/leaflet.canvas-markers.js
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ function layerFactory(L) {
}
},
_onMouseMove: function (e) {
if (!this._map || this._map.dragging.moving() || this._map._animatingZoom) { return; }
if (!this._map || !this._markers || this._map.dragging.moving() || this._map._animatingZoom) { return; }

var point = e.containerPoint;
this._handleMouseHover(e, point);
Expand Down

0 comments on commit ad96df0

Please sign in to comment.