diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2021-01-26 15:32:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-26 15:32:15 +0100 |
commit | 9c50d0ee0aa41c94f66af7e7d572f440f6aaddf5 (patch) | |
tree | babed6adc5545e7287021367f431697e28017e46 | |
parent | 9f6a2aa321de6118390deb436c2f482f9bf31797 (diff) | |
parent | e6145027efb4ad0a5615477c8df13761063c6157 (diff) |
Merge pull request #44887 from gongpha/crash!-on-expand-or-collapse-folder-in-filesystem-tree
Fix crash on FileSystemDock's tree when trying to collapse or expand folder
-rw-r--r-- | editor/filesystem_dock.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 8a248f4f35..e1c66f43b9 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) { |