Index: branches/pap/psModules/src/camera/pmFPAWrite.c
===================================================================
--- branches/pap/psModules/src/camera/pmFPAWrite.c	(revision 23948)
+++ branches/pap/psModules/src/camera/pmFPAWrite.c	(revision 25027)
@@ -160,9 +160,26 @@
     psArray **imageArray = appropriateImageArray(hdu, type); // Array of images in the HDU
 
+    // XXX detect missing variance & mask images...
+
     // Generate the HDU if needed --- this is required after a pmFPACopy, or similar, which does not
     // generate the HDU, but only copies the structure.
-    if (!blank && !hdu->blankPHU && !*imageArray && (!pmHDUGenerateForCell(cell) || !*imageArray)) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to generate HDU for cell --- likely programming error.");
-        return false;
+    if (!blank && !hdu->blankPHU && !*imageArray) {
+	if (!pmHDUGenerateForCell(cell)) {
+	    psError(PS_ERR_UNKNOWN, false, "Unable to generate HDU for cell --- likely programming error.");
+	    return false;
+	}
+	if (!*imageArray) {
+	    if (type == FPA_WRITE_TYPE_IMAGE) {
+		psError(PS_ERR_UNKNOWN, false, "Expected to write an image, but it is missing...programming error?.");
+		return false;
+	    }
+	    if (type == FPA_WRITE_TYPE_MASK) {
+		psWarning("No mask image for this cell; skipping");
+	    }
+	    if (type == FPA_WRITE_TYPE_VARIANCE) {
+		psWarning("No variance image for this cell; skipping");
+	    }
+	    return true;
+	}
     }
 
@@ -724,5 +741,5 @@
     }
     if (!psFitsCompressionApply(fits, compress)) {
-        psError(PS_ERR_UNKNOWN, false, "Unable to set FITS compression to NONE");
+        psError(PS_ERR_UNKNOWN, false, "Unable to restore FITS compression");
         psFree(compress);
         return false;
