Ensure that nogo weight is not null nor undefined before using it

This commit is contained in:
Gautier Pelloux-Prayer 2019-05-19 12:01:48 +02:00
parent 9aacfb488c
commit 64ceccf780

View file

@ -40,7 +40,6 @@ L.BRouter = L.Class.extend({
getUrlParams: function(latLngs, format) { getUrlParams: function(latLngs, format) {
params = {}; params = {};
if (this._getLonLatsString(latLngs) != null) if (this._getLonLatsString(latLngs) != null)
params.lonlats = this._getLonLatsString(latLngs); params.lonlats = this._getLonLatsString(latLngs);
@ -269,6 +268,7 @@ L.BRouter = L.Class.extend({
// -1 is default nogo exclusion, it should not be passed as a URL parameter. // -1 is default nogo exclusion, it should not be passed as a URL parameter.
if ( if (
circle.options.nogoWeight !== null && circle.options.nogoWeight !== null &&
circle.options.nogoWeight !== undefined &&
circle.options.nogoWeight !== -1 circle.options.nogoWeight !== -1
) { ) {
s += L.BRouter.NUMBER_SEPARATOR; s += L.BRouter.NUMBER_SEPARATOR;