From 2306be110627785f25c99bff9dae464c693922d9 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 3 Jan 2022 23:04:00 -0800 Subject: [PATCH] totals can go first as well as last --- src/language/stats/ctables.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) 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 -- 2.30.2