FIX: fix crash when cannot find preset

jira: STUDIO-9422
Change-Id: If81e1ac9379ccbc4b40cbda5cf8cb876ea230173
This commit is contained in:
zhimin.zeng 2024-12-27 14:12:47 +08:00 committed by lane.wei
parent 16791c72d6
commit 758d37d080
2 changed files with 5 additions and 0 deletions

View File

@ -1588,6 +1588,8 @@ void CalibrationPresetPage::update_combobox_filaments(MachineObject* obj)
}
Preset* printer_preset = get_printer_preset(obj, nozzle_value);
if (!printer_preset)
return;
auto opt_extruder_type = printer_preset->config.option<ConfigOptionEnumsGeneric>("extruder_type");
if (opt_extruder_type) {

View File

@ -1112,6 +1112,9 @@ bool Sidebar::priv::sync_extruder_list()
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
std::string target_model_id = preset_bundle->printers.get_selected_preset().get_printer_type(preset_bundle);
Preset* machine_preset = get_printer_preset(obj);
if (!machine_preset)
return false;
if (machine_print_name != target_model_id) {
MessageDialog dlg(this->plater, _L("The currently selected machine preset is inconsistent with the connected printer type.\n"
"Are you sure to continue syncing?"), _L("Sync extruder infomation"), wxICON_WARNING | wxYES | wxNO);