From 2493fd6465f5d9691c738a063816d011c60594c6 Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Wed, 17 May 2023 13:02:47 +0200 Subject: [PATCH] Fix hash formatting for POI at 0,0 Opening this URL and moving the map produces `pois=NaN,NaN` in the URL hash: https://brouter.de/brouter-web/#map=2/0/0/standard&pois=0,0,Null%20Island --- js/router/BRouter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/js/router/BRouter.js b/js/router/BRouter.js index 0f81a95..7b191f4 100644 --- a/js/router/BRouter.js +++ b/js/router/BRouter.js @@ -509,9 +509,9 @@ L.BRouter = L.Class.extend({ // formats L.LatLng object as lng,lat string _formatLatLng: function (latLng) { var s = ''; - s += L.Util.formatNum(latLng.lng || latLng[1], L.BRouter.PRECISION); + s += L.Util.formatNum(latLng.lng ?? latLng[1], L.BRouter.PRECISION); s += L.BRouter.NUMBER_SEPARATOR; - s += L.Util.formatNum(latLng.lat || latLng[0], L.BRouter.PRECISION); + s += L.Util.formatNum(latLng.lat ?? latLng[0], L.BRouter.PRECISION); return s; }, });