From 29530919b5f17dfda148e6d3e62646c8dc2c4d6c Mon Sep 17 00:00:00 2001 From: Henrik Fehlauer Date: Sat, 6 Jun 2020 18:00:00 +0000 Subject: [PATCH] Stop deleting points once there are no more points left Prevents "Uncaught TypeError: Cannot read property 'off' of null" in L.Routing.js --- js/plugin/Routing.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/js/plugin/Routing.js b/js/plugin/Routing.js index 38005f4..f0ee5ab 100644 --- a/js/plugin/Routing.js +++ b/js/plugin/Routing.js @@ -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() {