From f520fbc61fb3c702aa175c79fd298e6ce16942f5 Mon Sep 17 00:00:00 2001
From: Federico Montesino Pouzols <federico.montesino-pouzols@stfc.ac.uk>
Date: Sun, 11 Oct 2015 18:08:42 +0100
Subject: [PATCH] <0 divide-by-zero issue, 1075939, re #13918

---
 .../Geometry/src/Instrument/InstrumentDefinitionParser.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp b/Framework/Geometry/src/Instrument/InstrumentDefinitionParser.cpp
index cdc50169d55..5f07fbededa 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 "
-- 
GitLab