summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-12-13 11:10:37 +0100
committerAndreas Kling <kling@serenityos.org>2020-12-13 11:49:18 +0100
commit4da327d650af76f8541dd5a2509d6619ff4846ac (patch)
tree3b10748adc1b04c915143ab25fea15de7d47af7c
parent545ed01e7dd762309f4ef6e17f14f96b8c500dd2 (diff)
downloadserenity-4da327d650af76f8541dd5a2509d6619ff4846ac.zip
DisplaySettings: Allow unsetting the wallpaper
It was previously not possible to unset the wallpaper once set, since loading an image from the path "" would always fail.
-rw-r--r--Applications/DisplaySettings/MonitorWidget.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/Applications/DisplaySettings/MonitorWidget.cpp b/Applications/DisplaySettings/MonitorWidget.cpp
index cb83eefcd1..0cd87b9cec 100644
--- a/Applications/DisplaySettings/MonitorWidget.cpp
+++ b/Applications/DisplaySettings/MonitorWidget.cpp
@@ -35,10 +35,10 @@ MonitorWidget::MonitorWidget()
bool MonitorWidget::set_wallpaper(String path)
{
- m_desktop_wallpaper_path = path;
auto bitmap_ptr = Gfx::Bitmap::load_from_file(path);
- if (!bitmap_ptr)
+ if (!bitmap_ptr && !path.is_empty())
return false;
+ m_desktop_wallpaper_path = path;
m_desktop_wallpaper_bitmap = bitmap_ptr;
return true;
}