FIX: fix the default materials loading failed issue

Change-Id: I9341e6ec209673585a9ed3a981db92d28ac30659
This commit is contained in:
lane.wei 2022-11-29 14:46:05 +08:00 committed by Lane.Wei
parent 03226c9e43
commit b65d47b544

View file

@ -1197,7 +1197,12 @@ void PresetBundle::load_installed_filaments(AppConfig &config)
if (!add_default_materials) if (!add_default_materials)
continue; continue;
for (auto default_filament: printer.vendor->models[0].default_materials) const VendorProfile::PrinterModel *printer_model = PresetUtils::system_printer_model(printer);
if (!printer_model) {
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": can not find printer_model for printer %1%")%printer.name;
continue;
}
for (auto default_filament: printer_model->default_materials)
{ {
Preset* filament = filaments.find_preset(default_filament, false, true); Preset* filament = filaments.find_preset(default_filament, false, true);
if (filament && filament->is_system) if (filament && filament->is_system)