diff options
author | Guilhem Moulin <guilhem@fripost.org> | 2025-06-08 23:06:12 +0200 |
---|---|---|
committer | Guilhem Moulin <guilhem@fripost.org> | 2025-06-09 13:28:09 +0200 |
commit | a0156f862704d1f9cc858b93e0d61f9bd58c2cc8 (patch) | |
tree | 531e402063c69f876e35b89709db3bd695611374 | |
parent | ce8488b488ac218cb5b9fcf72873dc7b3d836531 (diff) |
info-modal: Don't crash for layers with unknown sources or URLs.
-rw-r--r-- | main.js | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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) { |