Index: branches/eam_branches/ipp-20110505/psModules/src/imcombine/pmSubtractionStamps.c
===================================================================
--- branches/eam_branches/ipp-20110505/psModules/src/imcombine/pmSubtractionStamps.c	(revision 31581)
+++ branches/eam_branches/ipp-20110505/psModules/src/imcombine/pmSubtractionStamps.c	(revision 31587)
@@ -834,15 +834,21 @@
             }
 
-            psStatsInit (stats);
-            if (!psVectorStats (stats, flux1, NULL, NULL, 0)) {
-                psAbort ("failed to generate stats");
-            }
-            float f1 = stats->sampleMedian;
-
-            psStatsInit (stats);
-            if (!psVectorStats (stats, flux2, NULL, NULL, 0)) {
-                psAbort ("failed to generate stats");
-            }
-            float f2 = stats->sampleMedian;
+            float f1 = NAN;
+            if (flux1->n > 0) {
+                psStatsInit (stats);
+                if (!psVectorStats (stats, flux1, NULL, NULL, 0)) {
+                    psAbort ("failed to generate stats");
+                }
+                f1 = stats->sampleMedian;
+            }
+
+            float f2 = NAN;
+            if (flux2->n > 0) {
+                psStatsInit (stats);
+                if (!psVectorStats (stats, flux2, NULL, NULL, 0)) {
+                    psAbort ("failed to generate stats");
+                }
+                f2 = stats->sampleMedian;
+            }
 
             stamps->window1->kernel[y][x] = f1;
@@ -893,4 +899,14 @@
     float R2 = Sr2 / Sf2;
 
+    if (!isfinite(R1) || !isfinite(R2)) {
+        psError(PM_ERR_STAMPS, true, "Kron Radii are not finite (failure to converge).");
+	psFree (stats);
+	psFree (flux1);
+	psFree (flux2);
+	psFree (norm1);
+	psFree (norm2);
+        return false;
+    }
+
     // Compare the Kron Radii (R1 & R2) to above to the FWHMs : if they are too discrepant, we will need to rescale
     psLogMsg ("psModules.imcombine", PS_LOG_DETAIL, "Kron Radii vs FWHMs 1: fwhm: %f, kron %f\n", fwhm1, R1);
@@ -901,4 +917,5 @@
     stamps->normWindow2 = 2.75*R2;
     psLogMsg ("psModules.imcombine", PS_LOG_DETAIL, "Windows from Kron Radii: %f for 1, %f for 2\n", stamps->normWindow1, stamps->normWindow2);
+
 
     // if the calculated normWindows are too large, we will fall off the stamps.  In this case, we need to try again.
@@ -913,14 +930,4 @@
 	psFree (norm2);
 	return false; 
-    }
-
-    if (!isfinite(R1) || !isfinite(R2)) {
-        psError(PM_ERR_STAMPS, true, "Kron Radii are not finite (failure to converge).");
-	psFree (stats);
-	psFree (flux1);
-	psFree (flux2);
-	psFree (norm1);
-	psFree (norm2);
-        return false;
     }
 
