Index: trunk/ppStack/src/ppStackSources.c
===================================================================
--- trunk/ppStack/src/ppStackSources.c	(revision 27004)
+++ trunk/ppStack/src/ppStackSources.c	(revision 27158)
@@ -127,5 +127,14 @@
     float airmassTerm = NAN;            // Airmass term
     float sumExpTime = 0.0;             // Sum of the exposure time
+    int numGoodImages = 0;              // Number of good images
     for (int i = 0; i < num; i++) {
+        psArray *sources = sourceLists->data[i]; // Source list
+        psAssert(sources, "Don't have source list %d", i);
+        if (sources->n == 0) {
+            options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] |= PPSTACK_MASK_CAL;
+            continue;
+        }
+        numGoodImages++;
+
         pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPSTACK.INPUT", i); // File of interest
         pmCell *cell = pmFPAviewThisCell(view, file->fpa); // Cell of interest
@@ -145,5 +154,4 @@
         psFree(fake);
 #endif
-
 
         float exptime = psMetadataLookupF32(NULL, cell->concepts, "CELL.EXPOSURE"); // Exposure time
