1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 07:08:10 +00:00

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
parent 545ed01e7d
commit 4da327d650

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