protection if grep in oils rpt tree returns null user/lew/reporter-draw-folders-glitch
authorLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Tue, 18 Apr 2023 18:14:56 +0000 (14:14 -0400)
committerLlewellyn Marshall <llewellyn.marshall@ncdcr.gov>
Tue, 18 Apr 2023 18:14:56 +0000 (14:14 -0400)
Open-ILS/web/reports/oils_rpt_tree.js

index 35dec1f..b9bfa2c 100644 (file)
@@ -18,11 +18,12 @@ function oilsLoadRptTree(callback) {
 }
 
 function oilsRptFindField(node, field) {
-       return grep( node.fields, 
+       var g = grep( node.fields, 
                function(f) {
                        return (f.name == field);
                }
-       )[0];
+       );
+       return g ? g[0] : [];
 }