From f6a0690b5154dfa650b463b39e96893be6c27a83 Mon Sep 17 00:00:00 2001 From: Dave Foster Date: Thu, 15 Mar 2018 13:55:47 -0400 Subject: [PATCH] Guard draw-background from being set if it doesn't exist, fixes #109, fixes #43, updates #91 --- src/SetBG.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/SetBG.cc b/src/SetBG.cc index bd7493c..43dbbb9 100644 --- a/src/SetBG.cc +++ b/src/SetBG.cc @@ -1288,7 +1288,15 @@ Glib::ustring SetBGGnome::get_gsettings_key() void SetBGGnome::set_show_desktop() { Glib::RefPtr settings = Gio::Settings::create(get_gsettings_key()); - settings->set_boolean("draw-background", true); + std::vector keys = settings->list_keys(); + + if (std::find(keys.begin(), keys.end(), Glib::ustring("draw-background")) != keys.end()) { + try { + settings->set_boolean("draw-background", true); + } catch (...) { + std::cerr << "ERROR: draw-background supposedly exists, but threw an error while setting it\n"; + } + } } /**