Skip to content

Commit

Permalink
Prevent JS errors when no tagName
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwindell authored Jul 4, 2024
1 parent 3ac558b commit 46357a6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion view/frontend/templates/image-catcher.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 46357a6

Please sign in to comment.