diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp index cdc50169d55ad5ab98597068d3a5a4ced1b04ddb..5f07fbededa7a15da6adf2bdbe492a3377930664 100644 --- a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp +++ b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp @@ -1554,6 +1554,13 @@ void InstrumentDefinitionParser::populateIdList(Poco::XML::Element *pE, increment = atoi((pIDElem->getAttribute("step")).c_str()); // check the start end and increment values are sensible + if (increment <= 0) { + std::stringstream ss; + ss << "The step element must be strictly positive, found step: " + << increment; + throw Kernel::Exception::InstrumentDefinitionError(ss.str(), + filename); + } if (((endID - startID) / increment) < 0) { std::stringstream ss; ss << "The start, end, and step elements do not allow a single id "