From 39eb7d963e15d9fd28cba874c7beb1a643a7fefc Mon Sep 17 00:00:00 2001
From: Steven Hahn <hahnse@ornl.gov>
Date: Mon, 21 Aug 2017 13:16:23 -0400
Subject: [PATCH] Don't draw slices outside bounds.

---
 .../PVPlugins/Representations/AlignedCutter.cxx           | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/qt/paraview_ext/PVPlugins/Representations/AlignedCutter.cxx b/qt/paraview_ext/PVPlugins/Representations/AlignedCutter.cxx
index ff61fa14607..41c95d2dc61 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) {
-- 
GitLab