summaryrefslogtreecommitdiffstats
path: root/editor/import_dock.cpp
diff options
context:
space:
mode:
authoraaronp64 <aaronp.code@gmail.com>2024-06-05 16:50:54 -0400
committeraaronp64 <aaronp.code@gmail.com>2024-06-05 16:50:54 -0400
commit3bf5fa9aea43dae45051e8fa7d9cbb0fef6d338e (patch)
treea77b49803576051441a34579b713adea4d2f03fd /editor/import_dock.cpp
parent96a386f3c424af96d950ee5098b4b0e4907c9508 (diff)
downloadredot-engine-3bf5fa9aea43dae45051e8fa7d9cbb0fef6d338e.tar.gz
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
Diffstat (limited to 'editor/import_dock.cpp')
-rw-r--r--editor/import_dock.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/editor/import_dock.cpp b/editor/import_dock.cpp
index 3c06c68414..2347c715a8 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<ConfigFile> &p_
params->base_options_path = p_path;
HashMap<StringName, Variant> import_options;
- List<String> section_keys;
- p_config->get_section_keys("params", &section_keys);
- for (const String &section_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<String> section_keys;
+ p_config->get_section_keys("params", &section_keys);
+ for (const String &section_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) {