Merge pull request #30918 from Chaosus/fix_crash

Fix filter crash in EditorFileDialog for MeshLib/TileSet conversion
This commit is contained in:
Rémi Verschelde 2019-07-29 13:25:11 +02:00 committed by GitHub
commit 5d172d5d9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -680,7 +680,12 @@ void EditorFileDialog::update_file_name() {
String filter_str = filters[idx]; String filter_str = filters[idx];
String file_str = file->get_text(); String file_str = file->get_text();
String base_name = file_str.get_basename(); String base_name = file_str.get_basename();
file_str = base_name + "." + filter_str.split(";")[1].strip_edges().to_lower(); Vector<String> 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); file->set_text(file_str);
} }
} }