diff options
author | Michael Catanzaro <mcatanzaro@redhat.com> | 2021-09-17 07:39:24 -0500 |
---|---|---|
committer | Michael Catanzaro <mcatanzaro@redhat.com> | 2021-09-17 07:39:24 -0500 |
commit | 2e35d4d2673189e3d7517470fc500fdaca59d5e2 (patch) | |
tree | c19439e8231226754a2cf35e2da6c109977329e1 | |
parent | dc14c82234434e988e4847119b30ee81e705b4de (diff) | |
download | gnome-settings-daemon-mcatanzaro/#585.tar.gz |
usb-protection: don't crash when screensaver service is unavailablemcatanzaro/#585
gnome_settings_bus_get_screen_saver_proxy() can return NULL, e.g. when
D-Bus is broken. We need to handle that case.
Fixes #585
-rw-r--r-- | plugins/usb-protection/gsd-usb-protection-manager.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/plugins/usb-protection/gsd-usb-protection-manager.c b/plugins/usb-protection/gsd-usb-protection-manager.c index 92e0f097..1139696c 100644 --- a/plugins/usb-protection/gsd-usb-protection-manager.c +++ b/plugins/usb-protection/gsd-usb-protection-manager.c @@ -964,6 +964,12 @@ usb_protection_proxy_ready (GObject *source_object, G_CALLBACK (settings_changed_callback), manager); manager->screensaver_proxy = gnome_settings_bus_get_screen_saver_proxy (); + if (!manager->screensaver_proxy) { + if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) + g_warning ("Failed to connect to screensaver service: %s", error->message); + g_clear_object (&manager->usb_protection); + return; + } get_current_screen_saver_status (manager); |