diff options
author | Andreas Kling <kling@serenityos.org> | 2021-11-27 17:37:00 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-11-28 08:10:53 +0100 |
commit | 45844f933845c203fd8aa2a31022ea917f231407 (patch) | |
tree | cf79b3b20b63a74592e95a7810e04cc8961a59a9 /Userland/Libraries/LibGUI/SettingsWindow.h | |
parent | 7c19e86a5023ee50d78b95d0d70749168f883e1c (diff) | |
download | serenity-45844f933845c203fd8aa2a31022ea917f231407.zip |
LibGUI: Make GUI::SettingsWindow::add_tab() return ErrorOr
This allows us to use TRY() when creating settings UI.
Diffstat (limited to 'Userland/Libraries/LibGUI/SettingsWindow.h')
-rw-r--r-- | Userland/Libraries/LibGUI/SettingsWindow.h | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibGUI/SettingsWindow.h b/Userland/Libraries/LibGUI/SettingsWindow.h index f68d0922c7..d942ff4c73 100644 --- a/Userland/Libraries/LibGUI/SettingsWindow.h +++ b/Userland/Libraries/LibGUI/SettingsWindow.h @@ -32,11 +32,11 @@ public: virtual ~SettingsWindow() override; template<class T, class... Args> - T& add_tab(StringView const& title, Args&&... args) + ErrorOr<NonnullRefPtr<T>> add_tab(String title, Args&&... args) { - auto& t = m_tab_widget->add_tab<T>(title, forward<Args>(args)...); - m_tabs.append(t); - return t; + auto tab = TRY(m_tab_widget->try_add_tab<T>(move(title), forward<Args>(args)...)); + TRY(m_tabs.try_append(tab)); + return tab; } private: |