From a0156f862704d1f9cc858b93e0d61f9bd58c2cc8 Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 8 Jun 2025 23:06:12 +0200 Subject: info-modal: Don't crash for layers with unknown sources or URLs. --- main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.js b/main.js index 661a17e..c1c7da9 100644 --- a/main.js +++ b/main.js @@ -539,10 +539,10 @@ if (window.location === window.parent.location) { infoMetadataAccordions.forEach((x) => x.element.replaceChildren()); modal.show(); Promise.allSettled(Object.entries(mapLayers).map(function([grp,lyr]) { - if (lyr.getSource() instanceof VectorTile) { + if (lyr !== null && lyr.getSource() instanceof VectorTile) { const url = lyr.getSource().getUrls()[0]; if (url === undefined || url.length <= 16 || url.substr(url.length - 16) !== '/{z}/{x}/{y}.pbf') { - throw new Error(`Invalid URL ${url}`); + return new Promise(() => { throw new Error(`Invalid URL ${url}`); }); } return fetch(url.substr(0, url.length - 16) + '/metadata.json') .then(function(resp0) { -- cgit v1.2.3