From 46357a64e9a926137df39dee21fb8fa5fb97b30c Mon Sep 17 00:00:00 2001 From: David Windell Date: Thu, 4 Jul 2024 12:15:05 +0100 Subject: [PATCH] Prevent JS errors when no tagName --- view/frontend/templates/image-catcher.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/frontend/templates/image-catcher.phtml b/view/frontend/templates/image-catcher.phtml index 10001bc..e488ff8 100644 --- a/view/frontend/templates/image-catcher.phtml +++ b/view/frontend/templates/image-catcher.phtml @@ -6,7 +6,7 @@ var replacedImages = []; window.addEventListener('error', (event) => { - if (event.target.tagName.toLowerCase() !== 'img') return; + if (event.target.tagName?.toLowerCase() !== 'img') return; const url = event.target.src.split('?')[0]; if (replacedImages.includes(url)) return; replacedImages.push(url);