- 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);