diff --git a/Framework/DataHandling/src/GroupDetectors2.cpp b/Framework/DataHandling/src/GroupDetectors2.cpp index 060f54bee77e172c5cfa3da87e6294c5f0aea2c2..c0d121a4847f16378ae738b6340aa8cfde934694 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);