FIX: fix a crash in update_printer_preset_name

JIRA: STUDIO-9540

Change-Id: Ia7243323d368c009ee18fbd1039d32b55b7fea0e
Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
Stone Li 2025-01-07 11:07:46 +08:00 committed by Lane.Wei
parent 8b0f16d3de
commit 19a265715c
1 changed files with 3 additions and 2 deletions

View File

@ -5397,8 +5397,9 @@ int MachineObject::get_flag_bits(int num, int start, int count)
void MachineObject::update_printer_preset_name(const std::string &nozzle_diameter_str)
{
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " " << __LINE__ << "start update preset_name";
auto preset_boundle = Slic3r::GUI::wxGetApp().preset_bundle;
auto printer_set = preset_boundle->get_printer_names_by_printer_type_and_nozzle(MachineObject::get_preset_printer_model_name(this->printer_type), nozzle_diameter_str);
auto preset_bundle = Slic3r::GUI::wxGetApp().preset_bundle;
if (!preset_bundle) return;
auto printer_set = preset_bundle->get_printer_names_by_printer_type_and_nozzle(MachineObject::get_preset_printer_model_name(this->printer_type), nozzle_diameter_str);
if (printer_set.size() > 0)
m_printer_preset_name = *printer_set.begin();
else