aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuilhem Moulin <guilhem@fripost.org>2025-06-08 23:06:12 +0200
committerGuilhem Moulin <guilhem@fripost.org>2025-06-09 13:28:09 +0200
commita0156f862704d1f9cc858b93e0d61f9bd58c2cc8 (patch)
tree531e402063c69f876e35b89709db3bd695611374
parentce8488b488ac218cb5b9fcf72873dc7b3d836531 (diff)
info-modal: Don't crash for layers with unknown sources or URLs.
-rw-r--r--main.js4
1 files 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) {