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.
This commit is contained in:
Timon Kruiper 2021-06-15 20:43:05 +02:00 committed by Ali Mohammad Pur
parent 9a9e7f03f2
commit a5ecac5494

View file

@ -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);