From 0b022db35dae34e2029f6e7631846646d70f60b1 Mon Sep 17 00:00:00 2001
From: Robert Lange <robert.lange@uni-leipzig.de>
Date: Wed, 18 May 2022 10:00:48 +0200
Subject: [PATCH] refs #21369 [finc] remove inline code; addendum: fix
 account_ajax.js, check if items exists

---
 themes/finc/js/account_ajax.js | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/themes/finc/js/account_ajax.js b/themes/finc/js/account_ajax.js
index 663dfb49e74..7fb72e08c8b 100644
--- a/themes/finc/js/account_ajax.js
+++ b/themes/finc/js/account_ajax.js
@@ -252,8 +252,12 @@ $(document).ready(function registerAccountAjax() {
 
   /* finc specific */
   $(document).ready(function () {
-    countables = new Array;
-    $('.itemCount').each(function() {
+    var menuItems = $('.itemCount');
+    if(menuItems.length === 0) {
+      return;
+    }
+    var countables = new Array;
+    menuItems.each(function() {
       countables.push($(this).attr('id'));
     });
 
-- 
GitLab