Index: trunk/ppTranslate/src/ppMopsWrite.c
===================================================================
--- trunk/ppTranslate/src/ppMopsWrite.c	(revision 32406)
+++ trunk/ppTranslate/src/ppMopsWrite.c	(revision 32413)
@@ -64,4 +64,7 @@
     for (long i=0; i<detections->n; i++) {
         ppMopsDetections *det = detections->data[i];
+	if (!det) {
+	    continue;
+	}
         total += det->num;
     }
@@ -257,5 +260,5 @@
         for (long i=0; i<detections->n; i++) {
             ppMopsDetections *det = detections->data[i];
-            if (det->num == 0) {
+            if (!det || det->num == 0) {
                 // no detections survived for this input
                 continue;
@@ -292,5 +295,5 @@
         for (long i=0; i<detections->n; i++) {
             ppMopsDetections *det = detections->data[i];
-            if (det->num == 0) {
+            if (!det || det->num == 0) {
                 // no detections survived for this input
                 continue;
@@ -362,4 +365,7 @@
     for (long i = 0; i<detections->n; i++) {
         ppMopsDetections *det = detections->data[i];
+	if (!det) {
+	    continue;
+	}
         psS64 diffSkyfileId = det->diffSkyfileId;
         for (long j = 0; j < det->num; j++) {
