From: Mike Gorse Date: Wed, 23 Oct 2013 15:14:23 +0000 (-0500) Subject: Check returned error before using when registering with session manager X-Git-Tag: AT_SPI2_CORE_2_11_1~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=87e41fc88987c421f993aeefab60a95568ed7c91;p=platform%2Fupstream%2Fat-spi2-core.git 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 --- 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);