about summary refs log tree commit diff stats
path: root/frontend/static/search.js
diff options
context:
space:
mode:
authorAlan Pearce2024-05-12 12:49:47 +0200
committerAlan Pearce2024-05-12 12:49:47 +0200
commit628c2a858191cde34478b760b3c8c6c23a420088 (patch)
tree9d1b247330ff349c5adbb26013014f52cbb07e97 /frontend/static/search.js
parent6ea867dfa9043e9f9beedaabc195a2657254bdc8 (diff)
downloadsearchix-628c2a858191cde34478b760b3c8c6c23a420088.tar.lz
searchix-628c2a858191cde34478b760b3c8c6c23a420088.tar.zst
searchix-628c2a858191cde34478b760b3c8c6c23a420088.zip
fix: js error when no results found
Diffstat (limited to 'frontend/static/search.js')
-rw-r--r--frontend/static/search.js8
1 files changed, 6 insertions, 2 deletions
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) {