[gnome-shell/matthiasc/misc-fixes: 1/3] shell_dbus_acquire_name: Don't assume error is set



commit 0bbb226faf3866f43c9c89174e18740eb04b29d9
Author: Matthias Clasen <mclasen redhat com>
Date:   Thu Sep 24 13:15:16 2015 -0400

    shell_dbus_acquire_name: Don't assume error is set
    
    In rare cases (mostly when the bus connection is going away),
    g_dbus_proxy_call_sync can return NULL without setting an error.
    Don't crash in this case.

 src/main.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index d984eec..f6d69e7 100644
--- a/src/main.c
+++ b/src/main.c
@@ -68,7 +68,7 @@ shell_dbus_acquire_name (GDBusProxy  *bus,
                                                        NULL, /* cancellable */
                                                        &error)))
     {
-      g_printerr ("failed to acquire %s: %s\n", name, error->message);
+      g_printerr ("failed to acquire %s: %s\n", name, error ? error->message : "");
       if (!fatal)
         return;
       exit (1);


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