From 235f39e449ebffed26114c7166b0b632a3f2232e Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sat, 6 Nov 2021 16:25:29 +0100 Subject: LibGfx: Use ErrorOr for Bitmap::try_load_from_file() This was used in a lot of places, so this patch makes liberal use of ErrorOr::release_value_but_fixme_should_propagate_errors(). --- Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp | 6 ++---- .../Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp | 10 +++++----- 2 files changed, 7 insertions(+), 9 deletions(-) (limited to 'Userland/Applications/SoundPlayer') diff --git a/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp b/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp index 04326d0e73..e7a5510ccd 100644 --- a/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp +++ b/Userland/Applications/SoundPlayer/NoVisualizationWidget.cpp @@ -20,11 +20,9 @@ void NoVisualizationWidget::paint_event(GUI::PaintEvent& event) Frame::paint_event(event); GUI::Painter painter(*this); - if (m_serenity_bg.is_null()) { - m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png"); - } + if (!m_serenity_bg) + m_serenity_bg = Gfx::Bitmap::try_load_from_file("/res/wallpapers/sunset-retro.png").release_value_but_fixme_should_propagate_errors(); painter.draw_scaled_bitmap(frame_inner_rect(), *m_serenity_bg, m_serenity_bg->rect(), 1.0f); - return; } void NoVisualizationWidget::set_buffer(RefPtr) diff --git a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp index 5ac1c80ab2..a66654b364 100644 --- a/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp +++ b/Userland/Applications/SoundPlayer/SoundPlayerWidgetAdvancedView.cpp @@ -43,11 +43,11 @@ SoundPlayerWidgetAdvancedView::SoundPlayerWidgetAdvancedView(GUI::Window& window m_player_view->set_layout(); - m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png"); - m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png"); - m_stop_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop.png"); - m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png"); - m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png"); + m_play_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/play.png").release_value_but_fixme_should_propagate_errors(); + m_pause_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/pause.png").release_value_but_fixme_should_propagate_errors(); + m_stop_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/stop.png").release_value_but_fixme_should_propagate_errors(); + m_back_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-back.png").release_value_but_fixme_should_propagate_errors(); + m_next_icon = Gfx::Bitmap::try_load_from_file("/res/icons/16x16/go-forward.png").release_value_but_fixme_should_propagate_errors(); m_visualization = m_player_view->add(); -- cgit v1.2.3