SPE-2369: Fixed crash when selecting Color Print view in preview (#12881)

This commit is contained in:
enricoturri1966 2024-06-24 11:25:41 +02:00 committed by Lukas Matena
parent 529a6fc0ae
commit 34346c9126
2 changed files with 5 additions and 4 deletions

View File

@ -873,8 +873,8 @@ void GCodeViewer::load_as_gcode(const GCodeProcessorResult& gcode_result, const
// collect color print colors
libvgcode::Palette color_print_colors;
color_print_colors.reserve(str_color_print_colors.size());
for (const std::string& color : str_color_print_colors) {
const std::vector<std::string>& str_colors = str_color_print_colors.empty() ? str_tool_colors : str_color_print_colors;
for (const std::string& color : str_colors) {
color_print_colors.emplace_back(libvgcode::convert(color));
}
m_viewer.set_color_print_colors(color_print_colors);

View File

@ -745,8 +745,9 @@ GCodeInputData convert(const Slic3r::Print& print, const std::vector<std::string
}
// collect color print colors
ret.color_print_colors.reserve(str_color_print_colors.size());
for (const std::string& color : str_color_print_colors) {
const std::vector<std::string>& str_colors = str_color_print_colors.empty() ? str_tool_colors : str_color_print_colors;
ret.color_print_colors.reserve(str_colors.size());
for (const std::string& color : str_colors) {
ret.color_print_colors.emplace_back(convert(color));
}