Ensure not undefined for polylines and polygons also (#183)

Which is the case when parsing polylines/polygons URL parameter without
weight.
This commit is contained in:
Norbert Renner 2019-05-21 18:10:28 +02:00
parent 64cc21a81f
commit 13407465f3

View file

@ -271,8 +271,8 @@ L.BRouter = L.Class.extend({
s += Math.round(circle.getRadius()); s += Math.round(circle.getRadius());
// -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 !== undefined && circle.options.nogoWeight !== undefined &&
circle.options.nogoWeight !== null &&
circle.options.nogoWeight !== -1 circle.options.nogoWeight !== -1
) { ) {
s += L.BRouter.NUMBER_SEPARATOR; s += L.BRouter.NUMBER_SEPARATOR;
@ -324,6 +324,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 (
polyline.options.nogoWeight !== undefined &&
polyline.options.nogoWeight !== null && polyline.options.nogoWeight !== null &&
polyline.options.nogoWeight !== -1 polyline.options.nogoWeight !== -1
) { ) {
@ -376,6 +377,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 (
polygon.options.nogoWeight !== undefined &&
polygon.options.nogoWeight !== null && polygon.options.nogoWeight !== null &&
polygon.options.nogoWeight !== -1 polygon.options.nogoWeight !== -1
) { ) {