Fix crash on datasets with single values (again) 20120327030501/pspp
authorJohn Darrington <john@darrington.wattle.id.au>
Mon, 26 Mar 2012 19:47:41 +0000 (21:47 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Mon, 26 Mar 2012 19:47:41 +0000 (21:47 +0200)
src/math/histogram.c

index 94d9852fd7c08d2758a59fa51a6bd341da60f902..f2f75e12b3af80a26c9ac24b4ed20e83ef5d7c8c 100644 (file)
@@ -156,14 +156,14 @@ histogram_create (double bin_width, double min, double max)
   int bins;
   double adjusted_min, adjusted_max;
 
-  assert (bin_width > 0);
-
   if (max == min)
     {
       msg (MW, _("Not creating histogram because the data contains less than 2 distinct values"));
       return NULL;
     }
 
+  assert (bin_width > 0);
+
   bins = adjust_bin_ranges (bin_width, min, max, &adjusted_min, &adjusted_max);
 
   /* Force the number of bins to lie in a sensible range. */