From a5ecac549444a301c3dc2d8c566291ac509a086c Mon Sep 17 00:00:00 2001 From: Timon Kruiper Date: Tue, 15 Jun 2021 20:43:05 +0200 Subject: [PATCH] Help: Make sure the home page is actually shown when opening the app Previously `open_page` was called multiple times when opening the application, once for the actual page, but also in `tree_view.on_selection_change`. At startup there is no valid selection yet, which caused an empty page to be loaded. Prevent this by early returning if the `path` is null. --- Userland/Applications/Help/main.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Userland/Applications/Help/main.cpp b/Userland/Applications/Help/main.cpp index 5a310ff904..05d9ed6716 100644 --- a/Userland/Applications/Help/main.cpp +++ b/Userland/Applications/Help/main.cpp @@ -163,6 +163,9 @@ int main(int argc, char* argv[]) tree_view.on_selection_change = [&] { String path = model->page_path(tree_view.selection().first()); + if (path.is_null()) + return; + history.push(path); update_actions(); open_page(path);