mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-25 00:58:35 -07:00
FIX: gui: fix the crash after first loading configs
caused by printer_model missed in the setup stage jira: STUDIO-10966 Change-Id: I3a887de800c62c5dd355c9dce554e2b5828a1c55 (cherry picked from commit a598ce8d6127f750a0c6e514a51111b247186c41)
This commit is contained in:
parent
8de11c2f01
commit
45f6d3cf95
1 changed files with 11 additions and 4 deletions
|
|
@ -783,12 +783,19 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
|
|||
if (model_it.second.size() > 0) {
|
||||
variant = *model_it.second.begin();
|
||||
if (model_it.second.size() > 1) {
|
||||
const VendorProfile::PrinterModel &printer_model = *std::find_if(printer_profile.models.begin(), printer_profile.models.end(),
|
||||
[id = model_it.first](auto &m) { return m.id == id; });
|
||||
for (auto &vt : printer_model.variants) {
|
||||
if (std::find(model_it.second.begin(), model_it.second.end(), vt.name) != model_it.second.end()) { variant = vt.name; break; }
|
||||
if (printer_profile.models.size() > 0) {
|
||||
const VendorProfile::PrinterModel& printer_model = *std::find_if(printer_profile.models.begin(), printer_profile.models.end(),
|
||||
[id = model_it.first](auto& m) { return m.id == id; });
|
||||
for (auto& vt : printer_model.variants) {
|
||||
if (std::find(model_it.second.begin(), model_it.second.end(), vt.name) != model_it.second.end()) { variant = vt.name; break; }
|
||||
}
|
||||
}
|
||||
else if (variant != PresetBundle::ORCA_DEFAULT_PRINTER_VARIANT){
|
||||
if (std::find(model_it.second.begin(), model_it.second.end(), PresetBundle::ORCA_DEFAULT_PRINTER_VARIANT) != model_it.second.end())
|
||||
variant = PresetBundle::ORCA_DEFAULT_PRINTER_VARIANT;
|
||||
}
|
||||
}
|
||||
|
||||
const auto config_old = old_enabled_vendors.find(bundle_name);
|
||||
if (config_old == old_enabled_vendors.end())
|
||||
return model_it.first;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue