From 9f554cbf05fe3a53dbe3fb91364560a8a02c6e19 Mon Sep 17 00:00:00 2001
From: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Date: Mon, 2 Dec 2024 10:56:34 +0100
Subject: [PATCH] Bug 38255: Early return if the node does not exist

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
---
 koha-tmpl/intranet-tmpl/prog/js/datatables.js | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/koha-tmpl/intranet-tmpl/prog/js/datatables.js b/koha-tmpl/intranet-tmpl/prog/js/datatables.js
index fab7d319886..b9a3d8b7df0 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/datatables.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/datatables.js
@@ -1311,6 +1311,9 @@ function update_search_description(
     ) {
         var settings = null;
 
+        // Early return if the node does not exist
+        if (!this.length) return;
+
         if (options) {
             // Don't redefine the default initComplete
             if (options.initComplete) {
-- 
2.48.1