From 3bf5fa9aea43dae45051e8fa7d9cbb0fef6d338e Mon Sep 17 00:00:00 2001 From: aaronp64 Date: Wed, 5 Jun 2024 16:50:54 -0400 Subject: [PATCH] Fix Keep/Skip File import selection crash Added is_valid() and "params" key checks before trying to access ConfigFile's "params" section in ImportDock::_update_options, to handle case where selecting "Keep File" or "Skip File" importer passes in a null ConfigFile. Fixes #92785 --- editor/import_dock.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp index 3c06c684144..2347c715a8d 100644 --- a/editor/import_dock.cpp +++ b/editor/import_dock.cpp @@ -189,13 +189,15 @@ void ImportDock::_update_options(const String &p_path, const Ref &p_ params->base_options_path = p_path; HashMap import_options; - List section_keys; - p_config->get_section_keys("params", §ion_keys); - for (const String §ion_key : section_keys) { - import_options[section_key] = p_config->get_value("params", section_key); - } - if (params->importer.is_valid()) { - params->importer->handle_compatibility_options(import_options); + if (p_config.is_valid() && p_config->has_section("params")) { + List section_keys; + p_config->get_section_keys("params", §ion_keys); + for (const String §ion_key : section_keys) { + import_options[section_key] = p_config->get_value("params", section_key); + } + if (params->importer.is_valid()) { + params->importer->handle_compatibility_options(import_options); + } } for (const ResourceImporter::ImportOption &E : options) {