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



commit 87e41fc88987c421f993aeefab60a95568ed7c91
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 8c3f54a..1b8676f 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]