From cf0dfc73f27bc2444b655f298b957294cfcb0025 Mon Sep 17 00:00:00 2001 From: Jaifroid Date: Tue, 17 Jun 2025 14:01:34 +0100 Subject: [PATCH] Fix rare case of popover icons not found --- www/js/lib/popovers.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/www/js/lib/popovers.js b/www/js/lib/popovers.js index 4efd5500..b548ca8a 100644 --- a/www/js/lib/popovers.js +++ b/www/js/lib/popovers.js @@ -467,6 +467,12 @@ function addEventListenersToPopoverIcons (anchor, popover, doc) { } const closeIcon = doc.getElementById('popcloseicon'); const breakoutIcon = doc.getElementById('popbreakouticon'); + // If the icons are not found, do not add event listeners + if (!closeIcon || !breakoutIcon) { + console.warn('Popover icons not found in the document'); + return; + } + // Add the popoverisloading property to the popover so that it can be removed // Register mousedown event (should work in all contexts) closeIcon.addEventListener('mousedown', function () { closePopover(popover);