Applets/Network: Propagate errors with try_set_main_widget

Use try_set_main_widget instead of set_main_widget.
This commit is contained in:
creator1creeper1 2021-12-25 13:31:15 +01:00 committed by Andreas Kling
parent 43ecf1d429
commit f125d52622
Notes: sideshowbarker 2024-07-17 21:45:11 +09:00

View file

@ -183,8 +183,8 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
window->set_window_type(GUI::WindowType::Applet);
window->set_has_alpha_channel(true);
window->resize(16, 16);
auto& icon = window->set_main_widget<NetworkWidget>(display_notifications);
icon.load_from_file("/res/icons/16x16/network.png");
auto icon = TRY(window->try_set_main_widget<NetworkWidget>(display_notifications));
icon->load_from_file("/res/icons/16x16/network.png");
window->resize(16, 16);
window->show();