From 99e73977108a3036a95af25aee24bc50c0bb475d Mon Sep 17 00:00:00 2001
From: Federico Montesino Pouzols <federico.montesino-pouzols@stfc.ac.uk>
Date: Tue, 13 Oct 2015 16:13:48 +0100
Subject: [PATCH] error check, alleviate issue 1304130, probably won't fix it,
 re #13951

---
 Framework/DataHandling/src/GroupDetectors2.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp
index 060f54bee77..c0d121a4847 100644
--- a/Framework/DataHandling/src/GroupDetectors2.cpp
+++ b/Framework/DataHandling/src/GroupDetectors2.cpp
@@ -804,6 +804,10 @@ void GroupDetectors2::readFile(spec2index_map &specs2index, std::istream &File,
       numberOfSpectra = readInt(thisLine);
     } while (numberOfSpectra == EMPTY_LINE);
 
+    if (numberOfSpectra <= 0) {
+      throw std::invalid_argument("The number of spectra is zero or negative");
+    }
+
     // the value of this map is the list of spectra numbers that will be
     // combined into a group
     m_GroupSpecInds[spectrumNo].reserve(numberOfSpectra);
-- 
GitLab