FIX: clien crash when double extruder filament preset switch to single

extruder filament preset

Jira: STUDIO-12689
Change-Id: Ifab01dcbc0f42684655e3feae923bfeb82965d01
(cherry picked from commit 0b57ff3b537cf7c2fdc503ffd3e5b5567e84c5d4)
This commit is contained in:
weiting.ji 2025-07-02 17:27:55 +08:00 committed by Noisyfox
parent 013d2d8d6e
commit 6075302f98
2 changed files with 6 additions and 2 deletions

View file

@ -3573,7 +3573,9 @@ void TabFilament::update_filament_overrides_page(const DynamicPrintConfig* print
// "filament_seam_gap"
};
const int extruder_idx = m_variant_combo->GetSelection(); // #ys_FIXME
const int selection = 0; //m_variant_combo->GetSelection(); // TODO: Orca hack
auto opt = dynamic_cast<ConfigOptionVectorBase *>(m_config->option("filament_retraction_length"));
const int extruder_idx = selection < 0 || selection >= static_cast<int>(opt->size()) ? 0 : selection;
const bool have_retract_length = dynamic_cast<ConfigOptionVectorBase *>(m_config->option("filament_retraction_length"))->is_nil(extruder_idx) ||
m_config->opt_float("filament_retraction_length", extruder_idx) > 0;

View file

@ -1211,8 +1211,10 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig&
}
opt_idx = orig_opt_idx >= 0 ? orig_opt_idx : 0;
opt_key = get_pure_opt_key(opt_key);
auto option = config.option(opt_key);
if (config.option(opt_key)->is_nil())
if (option->is_scalar() && config.option(opt_key)->is_nil() ||
option->is_vector() && dynamic_cast<const ConfigOptionVectorBase *>(config.option(opt_key))->is_nil(opt_idx))
return _L("N/A");
wxString out;