Fix assert failure when only MOMENT_MEAN is needed on DESCRIPTIVES.
[pspp-builds.git] / src / descript.c
index 3aafb94e611c2cb6d44af8e1ab99269ea769cdb5..0492b33ed2378a232418f368326974eab88eaf00 100644 (file)
@@ -742,8 +742,14 @@ calc_descriptives (const struct casefile *cf, void *dsc_)
               continue;
             }
 
-          if (dv->moments != NULL)
-            moments_pass_one (dv->moments, x, weight);
+          if (dv->moments != NULL) 
+            {
+              if (dsc->max_moment > MOMENT_MEAN)
+                moments_pass_one (dv->moments, x, weight);
+              else
+                moments_pass_two (dv->moments, x, weight);
+            }
+
           if (x < dv->min)
             dv->min = x;
           if (x > dv->max)