diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp index be01df76f76..1f437408585 100644 --- a/editor/editor_file_dialog.cpp +++ b/editor/editor_file_dialog.cpp @@ -680,7 +680,12 @@ void EditorFileDialog::update_file_name() { String filter_str = filters[idx]; String file_str = file->get_text(); String base_name = file_str.get_basename(); - file_str = base_name + "." + filter_str.split(";")[1].strip_edges().to_lower(); + Vector filter_substr = filter_str.split(";"); + if (filter_substr.size() >= 2) { + file_str = base_name + "." + filter_substr[1].strip_edges().to_lower(); + } else { + file_str = base_name + "." + filter_str.get_extension().strip_edges().to_lower(); + } file->set_text(file_str); } }