FIX: diff preset crash with diff extruder count

Change-Id: Ifeb8f0aa1ff62aac663a6cc007da675af4d027fc
Jira: STUDIO-10458
This commit is contained in:
chunmao.guo 2025-02-14 22:40:15 +08:00 committed by lane.wei
parent 6817fca39f
commit af880399a5

View File

@ -1316,7 +1316,7 @@ static wxString get_string_value(std::string opt_key, const DynamicPrintConfig&
}
else {
auto values = config.opt<ConfigOptionFloats>(opt_key);
if (opt_idx < values->size())
if (values && opt_idx < values->size())
return double_to_string(values->get_at(opt_idx));
}
return _L("Undef");
@ -2133,7 +2133,7 @@ void DiffPresetDialog::update_tree()
wxString left_val = from_u8((boost::format("%1%") % left_config.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
wxString right_val = from_u8((boost::format("%1%") % right_congig.opt<ConfigOptionStrings>("extruder_colour")->values.size()).str());
m_tree->Append("extruders_count", type, "General", "Capabilities", local_label, left_val, right_val, category_icon_map.at("General"));
m_tree->Append("extruders_count", type, "General", "Capabilities", local_label, left_val, right_val, category_icon_map.at("Basic information"));
}
for (const std::string& opt_key : dirty_options) {