diff --git a/src/shared/options.c b/src/shared/options.c index 905307f88d..f92eabc1e6 100644 --- a/src/shared/options.c +++ b/src/shared/options.c @@ -525,7 +525,6 @@ int options_get_help_table_group( int r; assert(ret); - assert(ret_group); _cleanup_(table_unrefp) Table *table = NULL; @@ -594,7 +593,8 @@ int options_get_help_table_group( } *ret = TAKE_PTR(table); - *ret_group = group; + if (ret_group) + *ret_group = group; assert(opt - options < INT_MAX); return opt - options; diff --git a/src/shared/verbs.c b/src/shared/verbs.c index d152fdb7d9..c79659467b 100644 --- a/src/shared/verbs.c +++ b/src/shared/verbs.c @@ -641,11 +641,16 @@ int _command_print_verb_help( "Option namespace %s not found.", verb->option_namespace); _cleanup_(table_unrefp) Table *table = NULL; - const char *group; - r = options_get_help_table_group(optns, options_end, /* option_groups= */ NULL, &table, &group); + r = options_get_help_table_group( + optns, options_end, + /* option_groups= */ NULL, + &table, + /* ret_group= */ NULL); if (r < 0) return r; + /* Note: we assume that only one option group is used for a verb. If this ever + * stops being true, the code here would need to be adjusted to loop over groups. */ help_section("Options"); r = table_print_or_warn(table); if (r < 0)