From 3027b2e231b0fcefa9ab7c58bef163f1e967ee2b Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Wed, 2 Oct 2024 12:03:58 +0200 Subject: button: Don't error-out on dbus communication failure --- src/gpm-button.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/gpm-button.c b/src/gpm-button.c index c440c5b..c2e0532 100644 --- a/src/gpm-button.c +++ b/src/gpm-button.c @@ -270,9 +270,9 @@ gpm_button_is_lid_closed (GpmButton *button) NULL, &error ); if (proxy == NULL) { - g_error("Error connecting to dbus - %s", error->message); + g_warning ("Error connecting to dbus - %s", error->message); g_error_free (error); - return -1; + goto err; } res = g_dbus_proxy_call_sync (proxy, "Get", @@ -292,15 +292,16 @@ gpm_button_is_lid_closed (GpmButton *button) g_variant_unref (res); return lid; } else if (error != NULL ) { - g_error ("Error in dbus - %s", error->message); + g_warning ("Error in dbus - %s", error->message); g_error_free (error); + goto err; } return FALSE; } - else { - return up_client_get_lid_is_closed (button->priv->client); - } + +err: /* fall back on our client in case of error */ + return up_client_get_lid_is_closed (button->priv->client); } /** -- cgit v1.2.1