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.
This commit is contained in:
Andreas Kling 2020-12-13 11:10:37 +01:00
commit 4da327d650
Notes: sideshowbarker 2024-07-19 00:53:53 +09:00

View file

@ -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;
}