Fix preset transfer crash (#8744)

Fix preset transfer crash (SoftFever/OrcaSlicer#7991)
This commit is contained in:
Noisyfox 2025-03-08 00:49:25 +08:00 committed by GitHub
parent bc698a88df
commit 1d71ed5ade
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2383,13 +2383,17 @@ void DiffPresetDialog::button_event(Action act)
std::string DiffPresetDialog::get_left_preset_name(Preset::Type type)
{
PresetComboBox* cb = m_preset_combos[int(type - Preset::TYPE_PRINT)].presets_left;
PresetComboBox* cb = std::find_if(m_preset_combos.begin(), m_preset_combos.end(), [type](const DiffPresets& p) {
return p.presets_left->get_type() == type;
})->presets_left;
return Preset::remove_suffix_modified(get_selection(cb));
}
std::string DiffPresetDialog::get_right_preset_name(Preset::Type type)
{
PresetComboBox* cb = m_preset_combos[int(type - Preset::TYPE_PRINT)].presets_right;
PresetComboBox* cb = std::find_if(m_preset_combos.begin(), m_preset_combos.end(), [type](const DiffPresets& p) {
return p.presets_right->get_type() == type;
})->presets_right;
return Preset::remove_suffix_modified(get_selection(cb));
}