[gnome-power-manager] Ensure correct values for Icon and Tooltip properties



commit b0c23b90caa1f3adce3e297f35ac8cfeb2c45d61
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Wed Oct 27 17:53:53 2010 +0200

    Ensure correct values for Icon and Tooltip properties
    
    DBus cannot handle NULL, thus will assert if those properties are
    NULL and no error is set. Rather than including a new error, just
    return the empty string.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=631617
    Signed-off-by: Richard Hughes <richard hughsie com>

 src/gpm-manager.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/gpm-manager.c b/src/gpm-manager.c
index 120ca10..afc7566 100644
--- a/src/gpm-manager.c
+++ b/src/gpm-manager.c
@@ -2116,13 +2116,14 @@ gpm_manager_dbus_property_get (GDBusConnection *connection,
 
 	if (g_strcmp0 (property_name, "Icon") == 0) {
 		icon = gpm_engine_get_icon (manager->priv->engine);
-		tooltip = g_icon_to_string (icon);
-		retval = g_variant_new_string (tooltip);
+		if (icon != NULL)
+			tooltip = g_icon_to_string (icon);
+		retval = g_variant_new_string (tooltip != NULL ? tooltip : "");
 		goto out;
 	}
 	if (g_strcmp0 (property_name, "Tooltip") == 0) {
 		tooltip = gpm_engine_get_summary (manager->priv->engine);
-		retval = g_variant_new_string (tooltip);
+		retval = g_variant_new_string (tooltip != NULL ? tooltip : "");
 		goto out;
 	}
 out:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]