From bec978927a4d12ff7355a06a3300d9a01e09059d Mon Sep 17 00:00:00 2001 From: uvok cheetah Date: Tue, 11 Mar 2025 18:43:39 +0100 Subject: Prevent JS code crash if element ID not found --- _layouts/postlist.html | 3 +++ 1 file changed, 3 insertions(+) (limited to '_layouts') diff --git a/_layouts/postlist.html b/_layouts/postlist.html index ee9dde6..b6b29ef 100644 --- a/_layouts/postlist.html +++ b/_layouts/postlist.html @@ -64,6 +64,9 @@ layout: default const ids = {{ news_ids }}; for (currId of ids) { const currentBanner = document.getElementById(currId); + if (!currentBanner) { + continue; + } const closeLink = currentBanner.firstElementChild; const currentNewsClosed = localStorage.getItem(currId+"closed"); if (currentNewsClosed === "true") { -- cgit v1.2.3