mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 20:03:47 +00:00
Add fallback when color was not specified (crash fix) (#13002)
This commit is contained in:
@@ -1471,7 +1471,7 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig *con
|
|||||||
using ColorItem = std::pair<std::string, ColorRGBA>;
|
using ColorItem = std::pair<std::string, ColorRGBA>;
|
||||||
std::vector<ColorItem> colors;
|
std::vector<ColorItem> colors;
|
||||||
|
|
||||||
if (static_cast<PrinterTechnology>(config->opt_int("printer_technology")) == ptSLA) {
|
if (config->has("printer_technology") && static_cast<PrinterTechnology>(config->opt_int("printer_technology")) == ptSLA) {
|
||||||
const std::string& txt_color = config->opt_string("material_colour").empty() ?
|
const std::string& txt_color = config->opt_string("material_colour").empty() ?
|
||||||
print_config_def.get("material_colour")->get_default_value<ConfigOptionString>()->value :
|
print_config_def.get("material_colour")->get_default_value<ConfigOptionString>()->value :
|
||||||
config->opt_string("material_colour");
|
config->opt_string("material_colour");
|
||||||
@@ -1480,6 +1480,9 @@ void GLVolumeCollection::update_colors_by_extruder(const DynamicPrintConfig *con
|
|||||||
colors.push_back({ txt_color, rgba });
|
colors.push_back({ txt_color, rgba });
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (!config->has("filament_colour")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
const ConfigOptionStrings* filamemts_opt = dynamic_cast<const ConfigOptionStrings*>(config->option("filament_colour"));
|
const ConfigOptionStrings* filamemts_opt = dynamic_cast<const ConfigOptionStrings*>(config->option("filament_colour"));
|
||||||
if (filamemts_opt == nullptr)
|
if (filamemts_opt == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user