diff --git a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp index 42449909e9c5c753e0c457cc1314693f823d4b90..e9ebb4f2720fa6f0cdf618330ad5b9788b0b7909 100644 --- a/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp +++ b/Framework/MDAlgorithms/src/IntegrateMDHistoWorkspace.cpp @@ -147,13 +147,18 @@ void setMinMaxBins(Mantid::coord_t &pMin, Mantid::coord_t &pMax, snappedPMax += offset; snappedPMin += offset; - if (pMin != snappedPMin) { + if (snappedPMin < dimension->getMinimum()) { + snappedPMin = dimension->getMinimum(); + } else if (pMin != snappedPMin) { std::stringstream buffer; buffer << "Rounding min from: " << pMin << " to the nearest whole width at: " << snappedPMin; logger.warning(buffer.str()); } - if (pMax != snappedPMax) { + + if (snappedPMax > dimension->getMaximum()) { + snappedPMax = dimension->getMaximum(); + } else if (pMax != snappedPMax) { std::stringstream buffer; buffer << "Rounding max from: " << pMax << " to the nearest whole width at: " << snappedPMax; diff --git a/Framework/MDAlgorithms/test/CompactMDTest.h b/Framework/MDAlgorithms/test/CompactMDTest.h index 69056ca5a773758e22bff55f3926367a62870ede..f43aaaeb802178a3d5dda139e04a79eb13642c2c 100644 --- a/Framework/MDAlgorithms/test/CompactMDTest.h +++ b/Framework/MDAlgorithms/test/CompactMDTest.h @@ -216,7 +216,8 @@ public: outputWorkspace->getDimension(0)->getBinWidth(), inWS->getDimension(0)->getBinWidth()); } - void test_compact_md_throws_when_loading_empty_workspace() { + + void test_compact_md_does_not_throw_when_loading_empty_workspace() { using namespace Mantid::DataObjects; const size_t numDims = 1; const double signal = 0.0;