summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkleonc <9283098+kleonc@users.noreply.github.com>2022-08-07 02:47:02 +0200
committerkleonc <9283098+kleonc@users.noreply.github.com>2022-08-07 02:47:02 +0200
commit25ce459fc5e324227b8ef3b776c8c7e95a3c71a9 (patch)
tree05ef55fb820b9c411546956284a8459b175870ce
parent8f033f1d19ee9150558a4acdf2efcb13cf1b831b (diff)
`FileSystemDock` Fix crash when renaming a file in split mode
-rw-r--r--editor/filesystem_dock.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp
index 6638e2f42f..b823db68f0 100644
--- a/editor/filesystem_dock.cpp
+++ b/editor/filesystem_dock.cpp
@@ -1531,14 +1531,13 @@ void FileSystemDock::_folder_removed(String p_folder) {
void FileSystemDock::_rename_operation_confirm() {
String new_name = rename_dialog_text->get_text().strip_edges();
- String old_name = tree->get_selected()->get_text(0);
if (new_name.length() == 0) {
EditorNode::get_singleton()->show_warning(TTR("No name provided."));
return;
} else if (new_name.contains("/") || new_name.contains("\\") || new_name.contains(":")) {
EditorNode::get_singleton()->show_warning(TTR("Name contains invalid characters."));
return;
- } else if (to_rename.is_file && old_name.get_extension() != new_name.get_extension()) {
+ } else if (to_rename.is_file && to_rename.path.get_extension() != new_name.get_extension()) {
if (!EditorFileSystem::get_singleton()->get_valid_extensions().find(new_name.get_extension())) {
EditorNode::get_singleton()->show_warning(TTR("This file extension is not recognized by the editor.\nIf you want to rename it anyway, use your operating system's file manager.\nAfter renaming to an unknown extension, the file won't be shown in the editor anymore."));
return;