Index: trunk/magic/remove/src/streaksremove.c
===================================================================
--- trunk/magic/remove/src/streaksremove.c	(revision 32264)
+++ trunk/magic/remove/src/streaksremove.c	(revision 32408)
@@ -981,53 +981,53 @@
         }
 
-        // XXX: Handle case where numCols == 0 Can that happen?
-        // Previously we were writing a blank extension
-
-        // For speed we get intimate with the table
-        // avoid 2 * numRows lookups of the column number by looking
-        // it up ahead of time and verifying that the type is what we
-        // expect.
-        int xCol = psFitsTableGetColumnNumber(table, "X_PSF");
-        assert(xCol >= 0 && xCol < table->numCols);
-        assert(table->columns[xCol].type == PS_DATA_F32);
-
-        int yCol = psFitsTableGetColumnNumber(table, "Y_PSF");
-        assert(yCol >= 0 && yCol < table->numCols);
-        assert(table->columns[yCol].type == PS_DATA_F32);
-
-        // We mark censored rows in this array.
-        bool *rowCensored = psAlloc(table->numRows * sizeof(bool));
-        memset(rowCensored, 0, table->numRows * sizeof(bool));
         int numCensored = 0;
-
-        for (int i = 0 ; i < table->numRows; i++) {
+        bool *rowCensored = NULL;
+        if (table->numRows > 0) {
+            // For speed we get intimate with the table
+            // avoid 2 * numRows lookups of the column number by looking
+            // it up ahead of time and verifying that the type is what we
+            // expect.
+            int xCol = psFitsTableGetColumnNumber(table, "X_PSF");
+            assert(xCol >= 0 && xCol < table->numCols);
+            assert(table->columns[xCol].type == PS_DATA_F32);
+
+            int yCol = psFitsTableGetColumnNumber(table, "Y_PSF");
+            assert(yCol >= 0 && yCol < table->numCols);
+            assert(table->columns[yCol].type == PS_DATA_F32);
+
+            // We mark censored rows in this array.
+            rowCensored = psAlloc(table->numRows * sizeof(bool));
+            memset(rowCensored, 0, table->numRows * sizeof(bool));
+
+            for (int i = 0 ; i < table->numRows; i++) {
 
 #ifndef GO_SLOWER
-            psF32 x = table->columns[xCol].data.F32[i];
-            psF32 y = table->columns[yCol].data.F32[i];
+                psF32 x = table->columns[xCol].data.F32[i];
+                psF32 y = table->columns[yCol].data.F32[i];
 #else
-            psF32 x = psFitsTableGetF32(NULL, table, i, "X_PSF");
-            psF32 y = psFitsTableGetF32(NULL, table, i, "Y_PSF");
+                psF32 x = psFitsTableGetF32(NULL, table, i, "X_PSF");
+                psF32 y = psFitsTableGetF32(NULL, table, i, "Y_PSF");
 #endif
-            psImageMaskType mask;
-            if ((x >= maskImage->numCols) || (y >= maskImage->numRows) || (x <  0) || (y < 0) || isnan(x) || isnan(y)) {
-                mask = maskStreak;
-            } else {
-                mask = maskImage->data.PS_TYPE_IMAGE_MASK_DATA[(int)y][(int)x];
-            }
-
-            // Key the source if the center pixel is not masked with maskStreak
-            if (mask & maskStreak) {
-                rowCensored[i] = true;
-                numCensored++;
-            }
-        }
-
-        // remove the censored rows from the table
-        if (!psFitsTableCensor(table, rowCensored)) {
-            streaksExit("", PS_EXIT_PROG_ERROR);
-        }
-
-        addDestreakKeyword(header, true);
+                psImageMaskType mask;
+                if ((x >= maskImage->numCols) || (y >= maskImage->numRows) || (x <  0) || (y < 0) || isnan(x) || isnan(y)) {
+                    mask = maskStreak;
+                } else {
+                    mask = maskImage->data.PS_TYPE_IMAGE_MASK_DATA[(int)y][(int)x];
+                }
+
+                // Key the source if the center pixel is not masked with maskStreak
+                if (mask & maskStreak) {
+                    rowCensored[i] = true;
+                    numCensored++;
+                }
+            }
+
+            // remove the censored rows from the table
+            if (!psFitsTableCensor(table, rowCensored)) {
+                streaksExit("", PS_EXIT_PROG_ERROR);
+            }
+
+            addDestreakKeyword(header, true);
+        }
 
         if (table->numCols > 0) {
