From 8ebe2fb4d33153b5905cade3fabe83a9ddef0f03 Mon Sep 17 00:00:00 2001 From: "zhimin.zeng" Date: Wed, 12 Jul 2023 11:04:22 +0800 Subject: [PATCH] FIX: select preset in modifying, the preset is null Change-Id: If002b614af542c351c26b12a77123e3ce26f8301 --- src/slic3r/GUI/PresetComboBoxes.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/slic3r/GUI/PresetComboBoxes.cpp b/src/slic3r/GUI/PresetComboBoxes.cpp index 0ce3f3e61..cc506a3b7 100644 --- a/src/slic3r/GUI/PresetComboBoxes.cpp +++ b/src/slic3r/GUI/PresetComboBoxes.cpp @@ -1522,9 +1522,19 @@ void GUI::CalibrateFilamentComboBox::OnSelect(wxCommandEvent &evt) } m_is_compatible = true; static_cast(m_parent)->Enable(true); - std::string preset_name = m_collection->get_preset_name_by_alias(evt.GetString().ToUTF8().data()); + + std::string selected_name = evt.GetString().ToUTF8().data(); + selected_name = Preset::remove_suffix_modified(selected_name); + std::string preset_name = m_collection->get_preset_name_by_alias(selected_name); m_selected_preset = m_collection->find_preset(preset_name); + // if the selected preset is null, do not send tray_change event + if (!m_selected_preset) { + MessageDialog msg_dlg(nullptr, _L("The selected preset is null!"), wxEmptyString, wxICON_WARNING | wxOK); + msg_dlg.ShowModal(); + return; + } + wxCommandEvent e(EVT_CALI_TRAY_CHANGED); e.SetEventObject(m_parent); wxPostEvent(m_parent, e);