Index: trunk/psLib/src/fits/psFitsTable.c
===================================================================
--- trunk/psLib/src/fits/psFitsTable.c	(revision 28405)
+++ trunk/psLib/src/fits/psFitsTable.c	(revision 28507)
@@ -67,6 +67,18 @@
         return false;
     }
+    if (hdutype == IMAGE_HDU) {
+        // It could be an empty table
+        long size = 0;                  // Size of 'table'
+        if (fits_get_num_rows(fits->fd, &size, &status)) {
+            psFitsError(status, true, "Unable to determine size of table.");
+            return false;
+        }
+        if (size != 0) {
+            psFitsError(PS_ERR_BAD_FITS, true, "Current FITS HDU is not a table.");
+            return false;
+        }
+    }
     if (hdutype != ASCII_TBL && hdutype != BINARY_TBL) {
-        psError(PS_ERR_IO, true, _("Current FITS HDU is not a table."));
+        psError(PS_ERR_BAD_FITS, true, _("Current FITS HDU is not a table."));
         return false;
     }
