diff --git a/Userland/Applications/Help/MainWidget.cpp b/Userland/Applications/Help/MainWidget.cpp index 0ba220d696..b67390b1eb 100644 --- a/Userland/Applications/Help/MainWidget.cpp +++ b/Userland/Applications/Help/MainWidget.cpp @@ -213,7 +213,7 @@ ErrorOr MainWidget::set_start_page(Vector query_parameters) ErrorOr MainWidget::initialize_fallibles(GUI::Window& window) { - static String const help_index_path = TRY(TRY(try_make_ref_counted(Manual::sections[7 - 1], TRY(String::from_utf8("Help-index"sv))))->path()); + static String const help_index_path = TRY(TRY(Manual::PageNode::help_index_page())->path()); m_go_home_action = GUI::CommonActions::make_go_home_action([this](auto&) { m_history.push(help_index_path); open_page(help_index_path); diff --git a/Userland/Libraries/LibManual/Node.cpp b/Userland/Libraries/LibManual/Node.cpp index e8720f88ab..40c17d1913 100644 --- a/Userland/Libraries/LibManual/Node.cpp +++ b/Userland/Libraries/LibManual/Node.cpp @@ -25,8 +25,7 @@ ErrorOr> Node::try_create_from_query(Vector namespace Manual { @@ -26,4 +27,10 @@ ErrorOr PageNode::path() const return TRY(String::formatted("{}/{}.md", TRY(m_section->path()), m_page)); } +ErrorOr> PageNode::help_index_page() +{ + static NonnullRefPtr const help_index_page = TRY(try_make_ref_counted(sections[7 - 1], TRY(String::from_utf8("Help-index"sv)))); + return help_index_page; +} + } diff --git a/Userland/Libraries/LibManual/PageNode.h b/Userland/Libraries/LibManual/PageNode.h index 2e7a184669..66976a593f 100644 --- a/Userland/Libraries/LibManual/PageNode.h +++ b/Userland/Libraries/LibManual/PageNode.h @@ -30,6 +30,8 @@ public: ErrorOr path() const; + static ErrorOr> help_index_page(); + private: NonnullRefPtr m_section; String m_page;