diff --git a/Userland/Applications/DisplaySettings/MonitorWidget.cpp b/Userland/Applications/DisplaySettings/MonitorWidget.cpp index e4ba1f6387..672bb4ca57 100644 --- a/Userland/Applications/DisplaySettings/MonitorWidget.cpp +++ b/Userland/Applications/DisplaySettings/MonitorWidget.cpp @@ -30,23 +30,22 @@ bool MonitorWidget::set_wallpaper(String path) if (!is_different_to_current_wallpaper_path(path)) return false; - Threading::BackgroundAction>::construct( - [path](auto&) { - RefPtr bmp; - if (!path.is_empty()) - bmp = Gfx::Bitmap::try_load_from_file(path).release_value_but_fixme_should_propagate_errors(); - return bmp; + Threading::BackgroundAction>>::construct( + [path](auto&) -> ErrorOr> { + if (path.is_empty()) + return Error::from_errno(ENOENT); + return Gfx::Bitmap::try_load_from_file(path); }, - [this, path](RefPtr bitmap) { + [this, path](ErrorOr> bitmap_or_error) { // If we've been requested to change while we were loading the bitmap, don't bother spending the cost to // move and render the now stale bitmap. if (is_different_to_current_wallpaper_path(path)) return; - if (!bitmap.is_null()) - m_wallpaper_bitmap = move(bitmap); - else + if (bitmap_or_error.is_error()) m_wallpaper_bitmap = nullptr; + else + m_wallpaper_bitmap = bitmap_or_error.release_value(); m_desktop_dirty = true; update(); });