From d5e89f9a0144e0df6ba0cb45a97a1a598c96d8f1 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Mon, 7 Mar 2011 12:19:14 -0600 Subject: Putting in a protection and fixing the truth --- libdbusmenu-glib/menuitem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libdbusmenu-glib/menuitem.c') diff --git a/libdbusmenu-glib/menuitem.c b/libdbusmenu-glib/menuitem.c index 950889b..2e5a345 100644 --- a/libdbusmenu-glib/menuitem.c +++ b/libdbusmenu-glib/menuitem.c @@ -1180,19 +1180,23 @@ dbusmenu_menuitem_property_set_variant (DbusmenuMenuitem * mi, const gchar * pro } } - gboolean replaced = FALSE; gboolean remove = FALSE; gchar * hash_key = NULL; GVariant * hash_variant = NULL; gboolean inhash = g_hash_table_lookup_extended(priv->properties, property, (gpointer *)&hash_key, (gpointer *)&hash_variant); + if (inhash && hash_variant == NULL) { + g_warning("The property '%s' is in the hash with a NULL variant", property); + inhash = FALSE; + } + if (value != NULL) { /* NOTE: We're only marking this as replaced if this is true but we're actually replacing it no matter. This is so that the variant passed in sticks around which the caller may expect. They shouldn't, but it's low cost to remove bugs. */ - if (inhash || !g_variant_equal(hash_variant, value)) { + if (!inhash || !g_variant_equal(hash_variant, value)) { replaced = TRUE; } -- cgit v1.2.3