From: John Darrington Date: Sat, 31 Oct 2009 06:04:25 +0000 (+0100) Subject: Don't crash if all categorical variables are empty X-Git-Tag: lenny-x64-build51~5 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=11b8d81d6f403209b15bdf5a58ed2b98cd4ee3bb;p=pspp-builds.git Don't crash if all categorical variables are empty --- diff --git a/src/math/categoricals.c b/src/math/categoricals.c index d0762831..b1f0ce84 100644 --- a/src/math/categoricals.c +++ b/src/math/categoricals.c @@ -104,9 +104,7 @@ categoricals_dump (const struct categoricals *cat) struct hmap_node *node ; int x; - printf ("\n%s (%d) CC=%g:\n", var_get_name (vp->var), vp->base_subscript, vp->cc); - - assert (vp->reverse_value_map); + printf ("\n%s (%d) CC=%g n_cats=%d:\n", var_get_name (vp->var), vp->base_subscript, vp->cc, vp->n_cats); printf ("Reverse map\n"); for (x = 0 ; x < vp->n_cats; ++x) @@ -215,7 +213,7 @@ categoricals_update (struct categoricals *cat, const struct ccase *c) node->cc = 0.0; hmap_insert (&cat->vp[i].map, &node->node, hash); - cat->n_cats_total ++; + cat->n_cats_total++; node->subscript = cat->vp[i].n_cats++ ; }