diff options
author | Matthias Clasen <mclasen@redhat.com> | 2015-07-27 07:52:27 -0400 |
---|---|---|
committer | Matthias Clasen <mclasen@redhat.com> | 2015-07-27 07:53:40 -0400 |
commit | 08a3f3f3d2190c7ff393ea13c5a310ba8a13a2e0 (patch) | |
tree | 4f2db946297fd56e5510652851e9700053290272 /glib/goption.c | |
parent | 17871e6881beb401eebb8b05eccb01490cfa85b6 (diff) | |
download | glib-08a3f3f3d2190c7ff393ea13c5a310ba8a13a2e0.tar.gz |
GOptionContext: Don't crash without main group
This was introduced in 126c685f4aa and caused e.g. gdbus
to crash when called without arguments.
https://bugzilla.gnome.org/show_bug.cgi?id=752210
Diffstat (limited to 'glib/goption.c')
-rw-r--r-- | glib/goption.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/glib/goption.c b/glib/goption.c index 8a1848dad..0464c2e0b 100644 --- a/glib/goption.c +++ b/glib/goption.c @@ -854,9 +854,9 @@ g_option_context_get_help (GOptionContext *context, } } - g_string_append_printf (string, "%s\n %s", _("Usage:"), g_get_prgname()); + g_string_append_printf (string, "%s\n %s", _("Usage:"), g_get_prgname ()); if (context->help_enabled || - context->main_group->n_entries > 0 || + (context->main_group && context->main_group->n_entries > 0) || context->groups != NULL) g_string_append_printf (string, " %s", _("[OPTION...]")); |