[network-manager-applet/NETWORKMANAGER_APPLET_0_7] dbus: fix crash on error requesting bus name



commit 1ecf9bfe2d721729ca62218c5ac0d8cdc888dc73
Author: Jeffrey Bastian <jbastian redhat com>
Date:   Thu Aug 27 09:26:58 2009 -0500

    dbus: fix crash on error requesting bus name

 src/applet-dbus-manager.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/applet-dbus-manager.c b/src/applet-dbus-manager.c
index 68cce7f..b780b4d 100644
--- a/src/applet-dbus-manager.c
+++ b/src/applet-dbus-manager.c
@@ -139,7 +139,7 @@ static gboolean
 request_name (DBusGProxy *proxy, int flags, const char *detail)
 {
 	int request_name_result;
-	GError *error;
+	GError *error = NULL;
 
 	if (!dbus_g_proxy_call (proxy, "RequestName", &error,
 	                        G_TYPE_STRING, NM_DBUS_SERVICE_USER_SETTINGS,
@@ -148,8 +148,11 @@ request_name (DBusGProxy *proxy, int flags, const char *detail)
 	                        G_TYPE_UINT, &request_name_result,
 	                        G_TYPE_INVALID)) {
 		nm_warning ("Could not acquire the %s service.\n"
-		            "  Message: '%s'", detail, error->message);
-		g_error_free (error);
+		            "  Error: (%d) %s",
+		            detail,
+		            error ? error->code : -1,
+		            error && error->message ? error->message : "(unknown)");
+		g_clear_error (&error);
 		return FALSE;
 	}
 



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