FIX: gui: fix the crash after first loading configs
caused by printer_model missed in the setup stage jira: STUDIO-10966 Change-Id: I3a887de800c62c5dd355c9dce554e2b5828a1c55
This commit is contained in:
parent
956c3d6d84
commit
a598ce8d61
|
@ -869,12 +869,19 @@ bool GuideFrame::apply_config(AppConfig *app_config, PresetBundle *preset_bundle
|
||||||
if (model_it.second.size() > 0) {
|
if (model_it.second.size() > 0) {
|
||||||
variant = *model_it.second.begin();
|
variant = *model_it.second.begin();
|
||||||
if (model_it.second.size() > 1) {
|
if (model_it.second.size() > 1) {
|
||||||
const VendorProfile::PrinterModel &printer_model = *std::find_if(printer_profile.models.begin(), printer_profile.models.end(),
|
if (printer_profile.models.size() > 0) {
|
||||||
[id = model_it.first](auto &m) { return m.id == id; });
|
const VendorProfile::PrinterModel& printer_model = *std::find_if(printer_profile.models.begin(), printer_profile.models.end(),
|
||||||
for (auto &vt : printer_model.variants) {
|
[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 (std::find(model_it.second.begin(), model_it.second.end(), vt.name) != model_it.second.end()) { variant = vt.name; break; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (variant != PresetBundle::BBL_DEFAULT_PRINTER_VARIANT){
|
||||||
|
if (std::find(model_it.second.begin(), model_it.second.end(), PresetBundle::BBL_DEFAULT_PRINTER_VARIANT) != model_it.second.end())
|
||||||
|
variant = PresetBundle::BBL_DEFAULT_PRINTER_VARIANT;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const auto config_old = old_enabled_vendors.find(bundle_name);
|
const auto config_old = old_enabled_vendors.find(bundle_name);
|
||||||
if (config_old == old_enabled_vendors.end())
|
if (config_old == old_enabled_vendors.end())
|
||||||
return model_it.first;
|
return model_it.first;
|
||||||
|
|
Loading…
Reference in New Issue