mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 07:28:11 +00:00
FontEditor: Propagate errors using try_set_main_widget in main
This commit is contained in:
parent
de82901d4c
commit
deed6388ef
1 changed files with 5 additions and 5 deletions
|
@ -43,20 +43,20 @@ ErrorOr<int> 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<FontEditorWidget>();
|
||||
font_editor.initialize_menubar(*window);
|
||||
auto font_editor = TRY(window->try_set_main_widget<FontEditorWidget>());
|
||||
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::BitmapFont>(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;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue