diff options
author | Vojtech Bubnik <bubnikv@gmail.com> | 2022-01-07 22:04:07 +0300 |
---|---|---|
committer | Vojtech Bubnik <bubnikv@gmail.com> | 2022-01-10 10:26:33 +0300 |
commit | c5d1e2449c25bb9c9af8116b40c6b0f00d138f7b (patch) | |
tree | a4a28aec0e1395f77e9551afe1d855e1b63fe53d /src/slic3r/GUI | |
parent | 8636ec8b47a475b0a9f60a0dd281368b7f27b850 (diff) |
Fix of #7583: Wizard crashes due to accessing undefined AppConfig section.
Diffstat (limited to 'src/slic3r/GUI')
-rw-r--r-- | src/slic3r/GUI/ConfigWizard.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 66b27995f..dadf5d8ca 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -2720,8 +2720,11 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese return false; } else { - bool is_filaments_changed = app_config->get_section(AppConfig::SECTION_FILAMENTS) != appconfig_new.get_section(AppConfig::SECTION_FILAMENTS); - bool is_sla_materials_changed = app_config->get_section(AppConfig::SECTION_MATERIALS) != appconfig_new.get_section(AppConfig::SECTION_MATERIALS); + auto changed = [app_config, &appconfig_new = std::as_const(this->appconfig_new)](const std::string& section_name) { + return (app_config->has_section(section_name) ? app_config->get_section(section_name) : std::map<std::string, std::string>()) != appconfig_new.get_section(section_name); + }; + bool is_filaments_changed = changed(AppConfig::SECTION_FILAMENTS); + bool is_sla_materials_changed = changed(AppConfig::SECTION_MATERIALS); if ((check_unsaved_preset_changes = is_filaments_changed || is_sla_materials_changed)) { header = is_filaments_changed ? _L("Some filaments were uninstalled.") : _L("Some SLA materials were uninstalled."); if (!wxGetApp().check_and_keep_current_preset_changes(caption, header, act_btns, &apply_keeped_changes)) |