Index: trunk/psModules/src/imcombine/pmSubtractionStamps.c
===================================================================
--- trunk/psModules/src/imcombine/pmSubtractionStamps.c	(revision 23789)
+++ trunk/psModules/src/imcombine/pmSubtractionStamps.c	(revision 23791)
@@ -91,4 +91,7 @@
     bool clean = true;                  // Is the footprint clean?
     int numCols = mask->numCols, numRows = mask->numRows; // Size of image
+
+    int xMin = PS_MAX(x - footprint, 0), xMax = PS_MIN(x + footprint, numCols - 1); // Bounds in x
+    int yMin = PS_MAX(y - footprint, 0), yMax = PS_MIN(y + footprint, numRows - 1); // Bounds in y
 
     // Check the footprint bounds
@@ -123,6 +126,4 @@
 
     // Check the footprint
-    int xMin = PS_MAX(x - footprint, 0), xMax = PS_MIN(x + footprint, numCols - 1); // Bounds in x
-    int yMin = PS_MAX(y - footprint, 0), yMax = PS_MIN(y + footprint, numRows - 1); // Bounds in y
     if (clean) {
         for (int j = yMin; j <= yMax; j++) {
