From db0126ddc9e932ec0cb2d250e2768067928f31ec Mon Sep 17 00:00:00 2001
From: "Stephen A. Wood" <saw@jlab.org>
Date: Thu, 9 May 2019 15:52:54 -0400
Subject: [PATCH] Exit if an array in parameter file smaller than requested.

---
 src/THcParmList.cxx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/THcParmList.cxx b/src/THcParmList.cxx
index 240344c..c181fbd 100644
--- a/src/THcParmList.cxx
+++ b/src/THcParmList.cxx
@@ -657,7 +657,11 @@ Int_t THcParmList::ReadArray(const char* attrC, T* array, Int_t size)
   }
   Int_t sz = var->GetLen();
   const void *vp = var->GetValuePointer();
-  if(size != sz) {
+  if(size > sz) {
+    cout << "*** ERROR: requested " << size << " elements of " << attrC <<
+      " which has only " << sz << " elements" << endl;
+    exit(EXIT_FAILURE);
+  } else if(size < sz) {
     cout << "*** WARNING: requested " << size << " elements of " << attrC <<
       " which has length " << sz << endl;
   }
-- 
GitLab