Stop deleting points once there are no more points left

Prevents "Uncaught TypeError: Cannot read property 'off' of null"
in L.Routing.js
This commit is contained in:
Henrik Fehlauer 2020-06-06 18:00:00 +00:00
parent 48f8fe3524
commit 29530919b5

View file

@ -378,7 +378,9 @@ BR.Routing = L.Routing.extend({
},
deleteLastPoint: function() {
this.removeWaypoint(this.getLast(), function(err, data) {});
if ((lastPoint = this.getLast())) {
this.removeWaypoint(lastPoint, function(err, data) {});
}
},
_removeDistanceMarkers: function() {