Index: /trunk/psphot/src/psphotFitSourcesLinear.c
===================================================================
--- /trunk/psphot/src/psphotFitSourcesLinear.c	(revision 23444)
+++ /trunk/psphot/src/psphotFitSourcesLinear.c	(revision 23445)
@@ -63,6 +63,6 @@
         pmSource *source = sources->data[i];
 
-	// turn this bit off and turn it on again if we pass this test
-	source->mode &= ~PM_SOURCE_MODE_LINEAR_FIT;
+        // turn this bit off and turn it on again if we pass this test
+        source->mode &= ~PM_SOURCE_MODE_LINEAR_FIT;
 
         // skip non-astronomical objects (very likely defects)
@@ -70,5 +70,5 @@
         if (source->type == PM_SOURCE_TYPE_SATURATED) continue;
 
-	// do not include CRs in the full ensemble fit
+        // do not include CRs in the full ensemble fit
         if (source->mode & PM_SOURCE_MODE_CR_LIMIT) continue;
 
@@ -94,8 +94,12 @@
         if (y > AnalysisRegion.y1) continue;
 
-	source->mode |= PM_SOURCE_MODE_LINEAR_FIT;
+        source->mode |= PM_SOURCE_MODE_LINEAR_FIT;
         psArrayAdd (fitSources, 100, source);
     }
     psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "built fitSources: %f sec (%ld objects)\n", psTimerMark ("psphot.linear"), sources->n);
+
+    if (fitSources->n == 0) {
+        return true;
+    }
 
     // vectors to store stats for each object
@@ -189,8 +193,8 @@
     psLogMsg ("psphot.ensemble", PS_LOG_MINUTIA, "solve matrix: %f sec (%d elements)\n", psTimerMark ("psphot.linear"), sparse->Nelem);
 
-    // XXXX **** philosophical question: 
+    // XXXX **** philosophical question:
     // we measure bright objects in three passes: 1) linear fit; 2) non-linear fit; 3) linear fit:
-    // should retain the chisq and errors from the intermediate non-linear fit? 
-    // the non-linear fit provides better values for the position errors, and for 
+    // should retain the chisq and errors from the intermediate non-linear fit?
+    // the non-linear fit provides better values for the position errors, and for
     // extended sources, the shape errors
 
@@ -218,5 +222,5 @@
     for (int i = 0; final && (i < fitSources->n); i++) {
         pmSource *source = fitSources->data[i];
-	if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) continue;
+        if (source->mode & PM_SOURCE_MODE_NONLINEAR_FIT) continue;
         pmModel *model = pmSourceGetModel (NULL, source);
         pmSourceChisq (model, source->pixels, source->maskObj, source->variance, maskVal);
