X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fstats%2Fctables.c;h=18fd30b683b3a438dd41036f2a596773a18b53cc;hb=c7c9ddce88e8bff5065a425ef023d17ab595e675;hp=9c5b8ee6149d85e6aa5558cdb498466dcd06639e;hpb=b236d7ed51547e1096f0840748179fa1aeecbb2e;p=pspp diff --git a/src/language/stats/ctables.c b/src/language/stats/ctables.c index 9c5b8ee614..18fd30b683 100644 --- a/src/language/stats/ctables.c +++ b/src/language/stats/ctables.c @@ -2127,8 +2127,11 @@ ctables_categories_match (const struct ctables_categories *c, static const struct ctables_category * ctables_categories_total (const struct ctables_categories *c) { - const struct ctables_category *total = &c->cats[c->n_cats - 1]; - return total->type == CCT_TOTAL ? total : NULL; + const struct ctables_category *first = &c->cats[0]; + const struct ctables_category *last = &c->cats[c->n_cats - 1]; + return (first->type == CCT_TOTAL ? first + : last->type == CCT_TOTAL ? last + : NULL); } static void