1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-09 12:50:35 +00:00

Fix crash on FileSystemDock's tree when trying to collapse or expand folder

(cherry picked from commit e6145027ef)
This commit is contained in:
gongpha
2021-01-03 18:01:03 +07:00
committed by Rémi Verschelde
parent 9a3c5033f7
commit 47fc3f73ac

View File

@@ -74,6 +74,9 @@ bool FileSystemDock::_create_tree(TreeItem *p_parent, EditorFileSystemDirectory
subdirectory_item->set_metadata(0, lpath); subdirectory_item->set_metadata(0, lpath);
if (!p_select_in_favorites && (path == lpath || ((display_mode == DISPLAY_MODE_SPLIT) && path.get_base_dir() == lpath))) { if (!p_select_in_favorites && (path == lpath || ((display_mode == DISPLAY_MODE_SPLIT) && path.get_base_dir() == lpath))) {
subdirectory_item->select(0); 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) { if (p_unfold_path && path.begins_with(lpath) && path != lpath) {