Skip to content

Commit

Permalink
Merge pull request #64025 from kleonc/filesystem-dock-rename-crash-fix
Browse files Browse the repository at this point in the history
`FileSystemDock` Fix crash when renaming a file in split mode
  • Loading branch information
akien-mga authored Aug 7, 2022
2 parents 52c311f + 25ce459 commit f85a816
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions editor/filesystem_dock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f85a816

Please sign in to comment.