From 3f4397d8c78ad4d969a2bc0540d281e6c4990f5f Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 3 Nov 2022 22:20:57 +0000 Subject: [PATCH] Bug 32104: Prevent console error on additonal-contents.pl To test: 1. Make a new HTML customization, news item, or page with the text editor ( CodeMirror ). 2. Save the content ( not Save and continue ) 3. Notice the console error: 4. Apply patch 5. Try 1 & 2 again. 6. No error. Signed-off-by: David Nind --- .../prog/en/modules/tools/additional-contents.tt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt index 4db2b9e5d5..12460fcc55 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt @@ -676,7 +676,9 @@ /* Activate first tab and initialize its CodeMirror instance */ let firstTab = $("#tabs a:first"); firstTab.tab("show"); - initCodeMirror( firstTab[0].hash ); + if ( firstTab[0] ) { + initCodeMirror( firstTab[0].hash ); + } } $("#tabs a[data-toggle='tab']").on("shown.bs.tab", function (e) { -- 2.30.2