summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-07-29 13:25:11 +0200
committerGitHub <noreply@github.com>2019-07-29 13:25:11 +0200
commit5d172d5d9aaf05a247a517612def8fc719efa69f (patch)
treedb95425ff3d7e37e955a7ff48dfe9e04583b701d
parentd06da7193d9e02c43119e989ab88513b975e28e0 (diff)
parentaec53acd7dc7532143c5073f6a47a8463128badd (diff)
Merge pull request #30918 from Chaosus/fix_crash
Fix filter crash in EditorFileDialog for MeshLib/TileSet conversion
-rw-r--r--editor/editor_file_dialog.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index be01df76f7..1f43740858 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<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);
}
}