summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorgongpha <gongpha@hotmail.com>2021-01-03 18:01:03 +0700
committergongpha <gongpha@hotmail.com>2021-01-04 00:50:18 +0700
commite6145027efb4ad0a5615477c8df13761063c6157 (patch)
treecac117ad1df227a74fe32a5d5a0c142f8a479759 /editor
parent41e9028868e49669de83c82ba20fd9dcef0d1b8b (diff)
Fix crash on FileSystemDock's tree when trying to collapse or expand folder
Diffstat (limited to 'editor')
-rw-r--r--editor/filesystem_dock.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index e7a621eee6..c1da60a47b 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -76,6 +76,9 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
subdirectory_item->set_metadata(0, lpath);
if (!p_select_in_favorites && (path == lpath || ((display_mode == DISPLAY_MODE_SPLIT) && path.get_base_dir() == lpath))) {
subdirectory_item->select(0);
+ // Keep select an item when re-created a tree
+ // To prevent crashing when nothing is selected.
+ subdirectory_item->set_as_cursor(0);
}
if (p_unfold_path && path.begins_with(lpath) && path != lpath) {