Index: branches/eam_branches/psphot.stack.20100120/src/psphotMergeSources.c
===================================================================
--- branches/eam_branches/psphot.stack.20100120/src/psphotMergeSources.c	(revision 26748)
+++ branches/eam_branches/psphot.stack.20100120/src/psphotMergeSources.c	(revision 26772)
@@ -168,4 +168,5 @@
     if (!detections) {
         psLogMsg ("psphot", 3, "no psf sources for this readout");
+	return NULL;
     }
 
@@ -173,4 +174,5 @@
     if (!sources) {
         psLogMsg ("psphot", 3, "no psf sources for this readout");
+	return NULL;
     }
 
@@ -178,4 +180,7 @@
 }
 
+// this function is used to fix sources which were loaded externally, but have passed from
+// psphotDetectionsFromSources to psphotSourceStats and are now stored on
+// detections->newSources.
 bool psphotRepairLoadedSources (pmConfig *config, const pmFPAview *view) {
 
@@ -193,5 +198,5 @@
     }
 
-    psArray *sources = detections->allSources;
+    psArray *sources = detections->newSources;
     psAssert (sources, "missing sources?");
 
