From fb3d3a78114895cb02eeb0300231b5a96f602f8a Mon Sep 17 00:00:00 2001 From: Stefan Breunig Date: Wed, 13 Feb 2013 18:15:33 +0100 Subject: [PATCH] fix error when drawing polylines --- plugins/draw-tools.user.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/draw-tools.user.js b/plugins/draw-tools.user.js index 78e9afbe..98fdef2e 100644 --- a/plugins/draw-tools.user.js +++ b/plugins/draw-tools.user.js @@ -136,11 +136,13 @@ window.plugin.drawTools.enhancePolyLine = function() { // remove polyline markers because they get in the way L.Polyline.Draw.prototype._updateMarkerHandler = function() { + if(!this._markers) return; + if(this._markers.length >= 2) this._markerGroup.removeLayer(this._markers.shift()); if(this._markers.length >= 1) - this._markers[this._markers.length - 1].on('click', this._finishShape(), this); + this._markers[this._markers.length - 1].on('click', this._finishShape, this); } }