GCodeViewer - Fixed crash when importing gcode generated with Simplify3D and switching to tool view

This commit is contained in:
enricoturri1966 2021-09-07 12:25:30 +02:00
parent c1c8a60271
commit 761c06ed92
2 changed files with 11 additions and 6 deletions
src/slic3r/GUI

View file

@ -695,8 +695,8 @@ void GCodeViewer::refresh(const GCodeProcessor::Result& gcode_result, const std:
// update tool colors
m_tool_colors = decode_colors(str_tool_colors);
// ensure at least one (default) color is defined
if (m_tool_colors.empty())
// ensure there are enough colors defined
while (m_tool_colors.size() < std::max(size_t(1), gcode_result.extruders_count))
m_tool_colors.push_back(decode_color("#FF8000"));
// update ranges for coloring / legend