Index: trunk/psModules/src/detrend/pmFringeStats.c
===================================================================
--- trunk/psModules/src/detrend/pmFringeStats.c	(revision 23259)
+++ trunk/psModules/src/detrend/pmFringeStats.c	(revision 23989)
@@ -882,5 +882,8 @@
 
     psStats *stats = psStatsAlloc(PS_STAT_SAMPLE_MEDIAN | PS_STAT_SAMPLE_QUARTILE); // Statistics
-    psVectorStats(stats, diffs, NULL, mask, 1);
+    if (!psVectorStats(stats, diffs, NULL, mask, 1)) {
+	psError(PS_ERR_UNKNOWN, false, "failure to measure stats");
+	return 0;
+    }
     float middle = stats->sampleMedian; // The middle of the distribution
     float thresh = rej * 0.74 * (stats->sampleUQ - stats->sampleLQ); // The rejection threshold
@@ -969,9 +972,15 @@
 
     // Get rid of the extreme outliers by assuming most of the points are somewhat clustered
-    psVectorStats(median, science->f, NULL, NULL, 0);
+    if (!psVectorStats(median, science->f, NULL, NULL, 0)) {
+	psError(PS_ERR_UNKNOWN, false, "failure to measure stats");
+	return NULL;
+    }
     scale->coeff->data.F32[0] = median->sampleMedian;
     for (int i = 0; i < fringes->n; i++) {
         pmFringeStats *fringe = fringes->data[i]; // The fringe of interest
-        psVectorStats(median, fringe->f, NULL, NULL, 0);
+        if (!psVectorStats(median, fringe->f, NULL, NULL, 0)) {
+	    psError(PS_ERR_UNKNOWN, false, "failure to measure stats");
+	    return NULL;
+	}
         scale->coeff->data.F32[0] -= median->sampleMedian;
         scale->coeff->data.F32[i] = 0.0;
