From 12ceb077acf25834c0914e13eb7799e08aedeb58 Mon Sep 17 00:00:00 2001 From: Per Liedman Date: Fri, 28 Sep 2018 16:28:05 +0200 Subject: [PATCH] Don't route until we have a map; fixes #462 --- src/control.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/control.js b/src/control.js index a5e0384d..08cd6111 100644 --- a/src/control.js +++ b/src/control.js @@ -39,10 +39,6 @@ if (options.routeWhileDragging) { this._setupRouteDragging(); } - - if (this.options.autoRoute) { - this.route(); - } }, _onZoomEnd: function() { @@ -72,6 +68,10 @@ }, onAdd: function(map) { + if (this.options.autoRoute) { + this.route(); + } + var container = Itinerary.prototype.onAdd.call(this, map); this._map = map;