From 0ec37c0d64d9f5a8093521041700dd76fbcefb57 Mon Sep 17 00:00:00 2001 From: angel Date: Sun, 19 Apr 2020 15:11:43 +0200 Subject: [PATCH] FileManager: Ignore empty selections on tree view If the selection is empty, the model index will be invalid and the file system model will return the root directory path by default. This causes the file manager to jump to the root directory when the currently selected item on the tree view is deselected. --- Applications/FileManager/main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Applications/FileManager/main.cpp b/Applications/FileManager/main.cpp index 90b0d10caa..4350056dd3 100644 --- a/Applications/FileManager/main.cpp +++ b/Applications/FileManager/main.cpp @@ -702,6 +702,8 @@ int run_in_windowed_mode(RefPtr config, String initial_locatio }; tree_view.on_selection_change = [&] { + if (tree_view.selection().is_empty()) + return; auto path = directories_model->full_path(tree_view.selection().first()); if (directory_view.path() == path) return;