Check returned error before using when registering with session manager
authorMike Gorse <mgorse@suse.com>
Wed, 23 Oct 2013 15:14:23 +0000 (10:14 -0500)
committerMike Gorse <mgorse@suse.com>
Wed, 23 Oct 2013 15:14:23 +0000 (10:14 -0500)
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

index 8c3f54a..1b8676f 100644 (file)
@@ -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);