Support URL even if latlon are missing

This commit is contained in:
Gautier Pelloux-Prayer 2017-04-07 08:42:52 +02:00
parent e82f360d9c
commit 0947bbc89c
2 changed files with 2 additions and 6 deletions

View file

@ -236,11 +236,7 @@
profile.update(routingOptions.getOptions());
urlHash = new L.Hash(map, mapLayers, function() {
var latLngs = routing.getWaypoints();
if (latLngs.length > 1) {
return router.getUrl(latLngs, null);
}
return null;
return router.getUrl(routing.getWaypoints(), null);
});
routingOptions.on('update', urlHash.updateHash, urlHash);
nogos.on('update', urlHash.updateHash, urlHash);

View file

@ -79,7 +79,7 @@ L.BRouter = L.Class.extend({
var urlParams = this.getUrlParams(latLngs, format);
var args = []
if (urlParams.lonlats != null)
if (urlParams.lonlats != null && urlParams.lonlats.length > 0)
args.push(L.Util.template('lonlats={lonlats}', urlParams));
if (urlParams.nogos != null)
args.push(L.Util.template('nogos={nogos}', urlParams));