summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorTimon Kruiper <timonkruiper@gmail.com>2021-06-15 20:43:05 +0200
committerAli Mohammad Pur <Ali.mpfard@gmail.com>2021-06-16 16:30:54 +0430
commita5ecac549444a301c3dc2d8c566291ac509a086c (patch)
treeca6db17a0fdcc68743906794f1acb7aa83ff7319 /Userland/Applications
parent9a9e7f03f29e876b636ba682aa21cfbf887a24db (diff)
downloadserenity-a5ecac549444a301c3dc2d8c566291ac509a086c.zip
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.
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/Help/main.cpp3
1 files changed, 3 insertions, 0 deletions
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);