Index: trunk/psModules/src/imcombine/pmSubtraction.c
===================================================================
--- trunk/psModules/src/imcombine/pmSubtraction.c	(revision 29620)
+++ trunk/psModules/src/imcombine/pmSubtraction.c	(revision 29772)
@@ -1375,4 +1375,8 @@
     // Calculate covariances
     // This can be fairly involved, so we only do it for a small number of instances
+        if (!out1->covariance) {
+            psError(PM_ERR_PROG, false, "psImageCovarianceAverage returned NULL.");
+            return false;
+        }
     float position[NUM_COVAR_POS] = { -1.0, -0.5, 0.0, +0.5, +1.0 }; // Positions for covariance calculations
     // Enable threads for covariance calculation, since we're not threading on top of it
@@ -1391,4 +1395,8 @@
         out1->covariance = psImageCovarianceAverage(covars);
         psFree(covars);
+        if (!out1->covariance) {
+            psError(PM_ERR_UNKNOWN, false, "psImageCovarianceAverage returned NULL for out1.");
+            return false;
+        }
         // Remove covariance factor from covariance, since we've put it in the variance map already
         float factor = psImageCovarianceFactor(out1->covariance);
@@ -1408,4 +1416,8 @@
         out2->covariance = psImageCovarianceAverage(covars);
         psFree(covars);
+        if (!out2->covariance) {
+            psError(PM_ERR_UNKNOWN, false, "psImageCovarianceAverage returned NULL for out2.");
+            return false;
+        }
         // Remove covariance factor from covariance, since we've put it in the variance map already
         float factor = psImageCovarianceFactor(out2->covariance);
