X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fmath%2Fcategoricals.c;h=239a3a833c6dbb61dd235b7fdaf37a340c78a057;hb=372c46a3648de939ec3224cc94ad944aa39623ae;hp=2a0d4f85ba9e000fb1e4ac36e5d37684f4d2a389;hpb=c427bfc34eb7db7e0b489091430fe1cb373b2261;p=pspp diff --git a/src/math/categoricals.c b/src/math/categoricals.c index 2a0d4f85ba..239a3a833c 100644 --- a/src/math/categoricals.c +++ b/src/math/categoricals.c @@ -358,7 +358,12 @@ categoricals_update (struct categoricals *cat, const struct ccase *c) { int i; struct variable_node *vn = NULL; - const double weight = cat->wv ? case_data (c, cat->wv)->f : 1.0; + double weight; + + if (NULL == cat) + return; + + weight = cat->wv ? case_data (c, cat->wv)->f : 1.0; assert (NULL == cat->reverse_variable_map_short); assert (NULL == cat->reverse_variable_map_long); @@ -453,6 +458,9 @@ categoricals_n_total (const struct categoricals *cat) size_t categoricals_df_total (const struct categoricals *cat) { + if (NULL == cat) + return 0; + return cat->df_sum; } @@ -479,6 +487,10 @@ categoricals_done (const struct categoricals *cat_) int i; int idx_short = 0; int idx_long = 0; + + if (NULL == cat) + return; + cat->df_sum = 0; cat->n_cats_total = 0;