From d42024d9289df6795c19911d08f3de1bee07f3f8 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 19 Jul 2021 18:48:22 +0200 Subject: [PATCH] Fix a crash when clicking reimport with the current 3.x head commit. --- plugin_collada/editor_import_collada_mdr.cpp | 8 +++++++- plugin_gltf/editor_import_gltf_mdr.cpp | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/plugin_collada/editor_import_collada_mdr.cpp b/plugin_collada/editor_import_collada_mdr.cpp index c48695f..9286814 100644 --- a/plugin_collada/editor_import_collada_mdr.cpp +++ b/plugin_collada/editor_import_collada_mdr.cpp @@ -57,10 +57,16 @@ String EditorImportColladaMdr::get_preset_name(int p_idx) const { Error EditorImportColladaMdr::import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { //MeshDataResource::ColliderType collider_type = static_cast(static_cast(p_options["collider_type"])); - Node *n = _importer->import_scene(p_source_file, 0, 15); + Error erri; + + Node *n = _importer->import_scene(p_source_file, 0, 15, nullptr, &erri); ERR_FAIL_COND_V(!n, Error::ERR_PARSE_ERROR); + if (erri != Error::OK) { + return erri; + } + Error err = process_node(n, p_source_file, p_save_path, p_options, r_platform_variants, r_gen_files, r_metadata); n->queue_delete(); diff --git a/plugin_gltf/editor_import_gltf_mdr.cpp b/plugin_gltf/editor_import_gltf_mdr.cpp index 65d4ad4..9869ce5 100644 --- a/plugin_gltf/editor_import_gltf_mdr.cpp +++ b/plugin_gltf/editor_import_gltf_mdr.cpp @@ -58,10 +58,16 @@ String EditorImportGLTFMdr::get_preset_name(int p_idx) const { Error EditorImportGLTFMdr::import(const String &p_source_file, const String &p_save_path, const Map &p_options, List *r_platform_variants, List *r_gen_files, Variant *r_metadata) { //MeshDataResource::ColliderType collider_type = static_cast(static_cast(p_options["collider_type"])); - Node *n = _importer->import_scene(p_source_file, 0, 15); + Error erri; + + Node *n = _importer->import_scene(p_source_file, 0, 15, nullptr, &erri); ERR_FAIL_COND_V(!n, Error::ERR_PARSE_ERROR); + if (erri != Error::OK) { + return erri; + } + Error err = process_node(n, p_source_file, p_save_path, p_options, r_platform_variants, r_gen_files, r_metadata); n->queue_delete();