From deed6388ef0cf17600a7323e8f35e936c96a1ed1 Mon Sep 17 00:00:00 2001 From: creator1creeper1 Date: Fri, 7 Jan 2022 14:22:48 +0100 Subject: [PATCH] FontEditor: Propagate errors using try_set_main_widget in main --- Userland/Applications/FontEditor/main.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Userland/Applications/FontEditor/main.cpp b/Userland/Applications/FontEditor/main.cpp index fefd531f94..6addaf0b43 100644 --- a/Userland/Applications/FontEditor/main.cpp +++ b/Userland/Applications/FontEditor/main.cpp @@ -43,20 +43,20 @@ ErrorOr serenity_main(Main::Arguments arguments) window->set_icon(app_icon.bitmap_for_size(16)); window->resize(440, 470); - auto& font_editor = window->set_main_widget(); - font_editor.initialize_menubar(*window); + auto font_editor = TRY(window->try_set_main_widget()); + font_editor->initialize_menubar(*window); if (path) { - auto success = font_editor.open_file(path); + auto success = font_editor->open_file(path); if (!success) return 1; } else { auto mutable_font = static_ptr_cast(Gfx::FontDatabase::default_font().clone())->unmasked_character_set(); - font_editor.initialize({}, move(mutable_font)); + font_editor->initialize({}, move(mutable_font)); } window->on_close_request = [&]() -> GUI::Window::CloseRequestDecision { - if (font_editor.request_close()) + if (font_editor->request_close()) return GUI::Window::CloseRequestDecision::Close; return GUI::Window::CloseRequestDecision::StayOpen; };