From 49ce6868ccba0928a401e15fe11689ebab711471 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Tue, 22 Jun 2010 14:07:28 -0500 Subject: Putting in several GValue checks to ensure we're getting what we thing we're getting. --- libdbusmenu-gtk/menuitem.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c index 57cd258..a250431 100644 --- a/libdbusmenu-gtk/menuitem.c +++ b/libdbusmenu-gtk/menuitem.c @@ -295,6 +295,9 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke if (wrapper == NULL) { return; } + if (!G_VALUE_HOLDS_BOXED(wrapper)) { + return; + } GValueArray * wrapperarray = (GValueArray *)g_value_get_boxed(wrapper); if (wrapperarray->n_values == 0) { @@ -306,6 +309,10 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke } GValue * ventryarray = g_value_array_get_nth(wrapperarray, 0); + if (!G_VALUE_HOLDS_BOXED(ventryarray)) { + return; + } + GValueArray * entryarray = (GValueArray *)g_value_get_boxed(ventryarray); if (entryarray->n_values == 0) { /* Seems a little odd, but really, we're saying that it isn't a @@ -316,6 +323,10 @@ dbusmenu_menuitem_property_get_shortcut (DbusmenuMenuitem * menuitem, guint * ke /* Parse through modifiers */ int i; for (i = 0; i < entryarray->n_values - 1; i++) { + if (!G_VALUE_HOLDS_STRING(g_value_array_get_nth(entryarray, i))) { + continue; + } + if (g_strcmp0(g_value_get_string(g_value_array_get_nth(entryarray, i)), DBUSMENU_MENUITEM_SHORTCUT_CONTROL) == 0) { *modifier |= GDK_CONTROL_MASK; continue; -- cgit v1.2.3