Index: trunk/psLib/src/fits/psFitsTable.c
===================================================================
--- trunk/psLib/src/fits/psFitsTable.c	(revision 28510)
+++ trunk/psLib/src/fits/psFitsTable.c	(revision 28511)
@@ -39,4 +39,25 @@
 
     int status = 0;                     // CFITSIO status
+
+    // Check for empty table, which looks like an image
+    int hdutype;                        // Type of HDU
+    fits_get_hdu_type(fits->fd, &hdutype, &status);
+    if (psFitsError(status, true, "Could not determine the HDU type.")) {
+        return -1;
+    }
+    if (hdutype == IMAGE_HDU) {
+        // It could be an empty table
+        int naxis = 0;                  // Dimensions of image
+        if (fits_get_img_dim(fits->fd, &naxis, &status) != 0) {
+            psFitsError(status, true, "Unable to determine dimension for table.");
+            return -1;
+        }
+        if (naxis != 0) {
+            psFitsError(PS_ERR_BAD_FITS, true, "Current FITS HDU is not a table.");
+            return -1;
+        }
+        return 0;
+    }
+
     long numRows;                       // Number of rows
     if (fits_get_num_rows(fits->fd, &numRows, &status)) {
@@ -48,9 +69,10 @@
 }
 
+
 // Check the FITS file in preparation for reading a table
 static bool readTableCheck(const psFits *fits // FITS file
                            )
 {
-    PS_ASSERT_FITS_NON_NULL(fits, NULL);
+    PS_ASSERT_FITS_NON_NULL(fits, false);
 
     if (psFitsGetExtNum(fits) == 0 && !psFitsMoveExtNum(fits, 1, false)) {
@@ -58,5 +80,4 @@
         return false;
     }
-
 
     // check that we are positioned on a table HDU
@@ -78,6 +99,5 @@
             return false;
         }
-    }
-    if (hdutype != ASCII_TBL && hdutype != BINARY_TBL) {
+    } else if (hdutype != ASCII_TBL && hdutype != BINARY_TBL) {
         psError(PS_ERR_BAD_FITS, true, _("Current FITS HDU is not a table."));
         return false;
