aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2012-03-20 22:53:24 -0500
committerTed Gould <ted@gould.cx>2012-03-20 22:53:24 -0500
commit0386a8f6273e5bca12af38402148ccb45194119d (patch)
tree88e8a5162e8a84691fc32562afddc7f7704dd1d8 /libdbusmenu-gtk
parent4801af0799f19a2921650cb7086c46bfeaf271b1 (diff)
downloadlibdbusmenu-0386a8f6273e5bca12af38402148ccb45194119d.tar.gz
libdbusmenu-0386a8f6273e5bca12af38402148ccb45194119d.tar.bz2
libdbusmenu-0386a8f6273e5bca12af38402148ccb45194119d.zip
Handle the case of the label being NULL which can happen on custom items
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/client.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/libdbusmenu-gtk/client.c b/libdbusmenu-gtk/client.c
index 9cb1144..31b01d5 100644
--- a/libdbusmenu-gtk/client.c
+++ b/libdbusmenu-gtk/client.c
@@ -745,17 +745,20 @@ process_a11y_desc (DbusmenuMenuitem * mi, GtkMenuItem * gmi, GVariant * variant,
* string, but GTK doesn't yet do the same, and setting the name to NULL
* causes tests to fail.
*/
- gchar * setname = NULL;
const gchar * label = NULL;
- /* We don't want the underscore for mnewmonics */
label = dbusmenu_menuitem_property_get(mi, DBUSMENU_MENUITEM_PROP_LABEL);
- GRegex * regex = g_regex_new ("_", 0, 0, NULL);
- setname = g_regex_replace_literal (regex, label, -1, 0, "", 0, NULL);
- g_regex_unref(regex);
+ if (label != NULL) {
+ gchar * setname = NULL;
- atk_object_set_name(aobj, setname);
- g_free(setname);
+ /* We don't want the underscore for mnewmonics */
+ GRegex * regex = g_regex_new ("_", 0, 0, NULL);
+ setname = g_regex_replace_literal (regex, label, -1, 0, "", 0, NULL);
+ g_regex_unref(regex);
+
+ atk_object_set_name(aobj, setname);
+ g_free(setname);
+ }
}
return;