You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-14 13:41:12 +00:00
Merge pull request #17443 from Noshyaar/tilesetcrash
Fix converting to tileset crashes Godot if existing file is not tileset
This commit is contained in:
@@ -1234,29 +1234,25 @@ void EditorNode::_dialog_action(String p_file) {
|
||||
} break;
|
||||
case FILE_EXPORT_TILESET: {
|
||||
|
||||
Ref<TileSet> ml;
|
||||
if (FileAccess::exists(p_file)) {
|
||||
ml = ResourceLoader::load(p_file, "TileSet");
|
||||
Ref<TileSet> tileset;
|
||||
if (FileAccess::exists(p_file) && file_export_lib_merge->is_pressed()) {
|
||||
tileset = ResourceLoader::load(p_file, "TileSet");
|
||||
|
||||
if (ml.is_null()) {
|
||||
if (file_export_lib_merge->is_pressed()) {
|
||||
current_option = -1;
|
||||
accept->get_ok()->set_text(TTR("I see.."));
|
||||
accept->set_text(TTR("Can't load TileSet for merging!"));
|
||||
accept->popup_centered_minsize();
|
||||
return;
|
||||
}
|
||||
} else if (!file_export_lib_merge->is_pressed()) {
|
||||
ml->clear();
|
||||
if (tileset.is_null()) {
|
||||
current_option = -1;
|
||||
accept->get_ok()->set_text(TTR("I see.."));
|
||||
accept->set_text(TTR("Can't load TileSet for merging!"));
|
||||
accept->popup_centered_minsize();
|
||||
return;
|
||||
}
|
||||
|
||||
} else {
|
||||
ml = Ref<TileSet>(memnew(TileSet));
|
||||
tileset = Ref<TileSet>(memnew(TileSet));
|
||||
}
|
||||
|
||||
TileSetEditor::update_library_file(editor_data.get_edited_scene_root(), ml, true);
|
||||
TileSetEditor::update_library_file(editor_data.get_edited_scene_root(), tileset, true);
|
||||
|
||||
Error err = ResourceSaver::save(p_file, ml);
|
||||
Error err = ResourceSaver::save(p_file, tileset);
|
||||
if (err) {
|
||||
|
||||
current_option = -1;
|
||||
|
||||
Reference in New Issue
Block a user