diff --git a/src/layer/vector/Polyline.js b/src/layer/vector/Polyline.js index 573d8888..c52d32cd 100644 --- a/src/layer/vector/Polyline.js +++ b/src/layer/vector/Polyline.js @@ -47,7 +47,7 @@ L.Polyline = L.Path.extend({ spliceLatLngs: function () { // (Number index, Number howMany) var removed = [].splice.apply(this._latlngs, arguments); - this._convertLatLngs(this._latlngs); + this._convertLatLngs(this._latlngs, true); this.redraw(); return removed; }, @@ -85,11 +85,11 @@ L.Polyline = L.Path.extend({ return bounds; }, - _convertLatLngs: function (latlngs) { - var i, len, target = []; + _convertLatLngs: function (latlngs, overwrite) { + var i, len, target = overwrite ? latlngs : []; for (i = 0, len = latlngs.length; i < len; i++) { - if (L.Util.isArray(latlngs[i]) && typeof latlngs[i][0] !== 'number') { + if (L.Util.isArray(latlngs[i]) && typeof latlngs[i][0] !== 'number') { return; } target[i] = L.latLng(latlngs[i]);