Index: trunk/psModules/src/imcombine/pmPSFEnvelope.c
===================================================================
--- trunk/psModules/src/imcombine/pmPSFEnvelope.c	(revision 23960)
+++ trunk/psModules/src/imcombine/pmPSFEnvelope.c	(revision 23961)
@@ -114,4 +114,5 @@
     psImageInit(envelope, SKY_VALUE);
     pmReadout *fakeRO = pmReadoutAlloc(NULL); // Fake readout
+    float maxRadius = 0.0;              // Maximum radius for sources
     psVector *numbers = psVectorAlloc(numFakes, PS_TYPE_S32); // Number of detections for each source
     psVectorInit(numbers, 0);
@@ -156,4 +157,17 @@
             psFree(subEnv);
 
+            // Get the radius
+            pmModel *model = pmModelFromPSFforXY(psf, x, y, PEAK_FLUX); // Model for source
+            if (!model || (model->flags & MODEL_MASK)) {
+                continue;
+            }
+            float srcRadius = model->modelRadius(model->params, PS_SQR(VARIANCE_VAL)); // Radius for source
+            if (srcRadius == 0) {
+                continue;
+            }
+            if (srcRadius > maxRadius) {
+                maxRadius = srcRadius;
+            }
+
             // If we got this far, the source is decent
             numbers->data.S32[j]++;
@@ -229,4 +243,11 @@
     numFakes = fakes->n;
 
+    if (numFakes == 0.0) {
+        psError(PS_ERR_UNKNOWN, false, "No fake sources are suitable for PSF fitting.");
+        psFree(fakes);
+        psFree(readout);
+        return false;
+    }
+
     // XXX Setting the variance seems to be an art
     // Can't set it too high so that pixels are rejected as insignificant
@@ -239,4 +260,8 @@
     readout->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK);
     psImageInit(readout->mask, 0);
+
+    if (maxRadius > radius) {
+        maxRadius = radius;
+    }
 
 #ifdef TESTING
