From d9b3278074ee89fc8f065dc7bb79a3341eaa2c86 Mon Sep 17 00:00:00 2001 From: creator1creeper1 Date: Sat, 25 Dec 2021 16:35:47 +0100 Subject: [PATCH] Utilities/notify: Propagate errors in Gfx::Bitmap loading --- Userland/Utilities/notify.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Userland/Utilities/notify.cpp b/Userland/Utilities/notify.cpp index 151b12d694..aaec57a8bc 100644 --- a/Userland/Utilities/notify.cpp +++ b/Userland/Utilities/notify.cpp @@ -25,8 +25,14 @@ int main(int argc, char** argv) auto notification = GUI::Notification::construct(); notification->set_text(message); notification->set_title(title); - if (icon_path) - notification->set_icon(Gfx::Bitmap::try_load_from_file(icon_path).release_value_but_fixme_should_propagate_errors()); + if (icon_path) { + ErrorOr> icon_or_error = Gfx::Bitmap::try_load_from_file(icon_path); + if (icon_or_error.is_error()) { + warnln("Failed to load icon: {}", icon_or_error.error()); + return 1; + } + notification->set_icon(icon_or_error.release_value()); + } notification->show(); return 0;