diff --git a/qt/paraview_ext/PVPlugins/Representations/AlignedCutter.cxx b/qt/paraview_ext/PVPlugins/Representations/AlignedCutter.cxx index ff61fa1460740f16b5690090ed08e337b3463baa..41c95d2dc61f67c5333217e52b94448bafa75c16 100644 --- a/qt/paraview_ext/PVPlugins/Representations/AlignedCutter.cxx +++ b/qt/paraview_ext/PVPlugins/Representations/AlignedCutter.cxx @@ -275,9 +275,13 @@ void AlignedCutter::StructuredGridCutter(vtkDataSet *dataSetInput, double *ptr = cutScalars->GetPointer(0); vtkIdType min = std::distance( ptr, std::min_element(ptr, ptr + cutScalars->GetNumberOfTuples())); + + // check for out-of-bounds values + if (min == 0 || min == celldims[AxisNumber]) + break; + min = std::min(min, static_cast<vtkIdType>(celldims[AxisNumber] - 1)); - // set out of bounds values; - + if (AxisNumber == 0) { for (int j = 0; j < celldims[1]; ++j) { for (int k=0; k < celldims[2]; ++k) {