From 628c2a858191cde34478b760b3c8c6c23a420088 Mon Sep 17 00:00:00 2001 From: Alan Pearce Date: Sun, 12 May 2024 12:49:47 +0200 Subject: fix: js error when no results found --- frontend/static/search.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'frontend/static') diff --git a/frontend/static/search.js b/frontend/static/search.js index edaf65f..a65e10c 100644 --- a/frontend/static/search.js +++ b/frontend/static/search.js @@ -56,8 +56,12 @@ function renderFragmentHTML(html) { pagination = fragment.querySelector("#pagination"); range.deleteContents(); range.insertNode(fragment); - addToggleEventListeners(results); - addPaginationEventListeners(pagination); + if (results !== null) { + addToggleEventListeners(results); + } + if (pagination !== null) { + addPaginationEventListeners(pagination); + } } function getResults(url) { -- cgit 1.4.1