[at-spi2-core/gnome-3-10] Check returned error before using when registering with session manager



commit c86bd852d19d48e5ec7414d107b11419adacbb9c
Author: Mike Gorse <mgorse suse com>
Date:   Wed Oct 23 10:14:23 2013 -0500

    Check returned error before using when registering with session manager
    
    Apparently, the call to register with gnome-session-manager can fail without
    setting a GError, and, in any case, it doesn't hurt to check that the error
    is set before using it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710689

 registryd/registry-main.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/registryd/registry-main.c b/registryd/registry-main.c
index b088b1a..8707be4 100644
--- a/registryd/registry-main.c
+++ b/registryd/registry-main.c
@@ -157,8 +157,11 @@ register_client (void)
                                                      startup_id),
                                       0, 1000, NULL, &error);
         if (! res) {
-                g_warning ("Failed to register client: %s", error->message);
-                g_error_free (error);
+                const char *message = (error && error->message ? error->message
+                                       : "no error");
+                g_warning ("Failed to register client: %s", message);
+                if (error)
+                  g_error_free (error);
                 return FALSE;
         }
         g_variant_get (res, "(o)", &client_id);


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