aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Gould <ted@gould.cx>2010-06-22 14:07:28 -0500
committerTed Gould <ted@gould.cx>2010-06-22 14:07:28 -0500
commit49ce6868ccba0928a401e15fe11689ebab711471 (patch)
treeb59e0e9829f4f2fd9fe42f7a720dc7e88044a577
parent4a755f012fbd4fa6050901ac6d8402b35c26985b (diff)
downloadlibdbusmenu-49ce6868ccba0928a401e15fe11689ebab711471.tar.gz
libdbusmenu-49ce6868ccba0928a401e15fe11689ebab711471.tar.bz2
libdbusmenu-49ce6868ccba0928a401e15fe11689ebab711471.zip
Putting in several GValue checks to ensure we're getting what we thing we're getting.
-rw-r--r--libdbusmenu-gtk/menuitem.c11
1 files changed, 11 insertions, 0 deletions
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;