FIX: crash when ams filament list is empty

1.Set the default size of ams filament to 2

jira:NONE

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Ie985ecfa44cb9fcaf21406303e32bb56e731f351
This commit is contained in:
xun.zhang 2024-09-12 16:49:43 +08:00 committed by lane.wei
parent 2f11ca8a03
commit b4d8566332
1 changed files with 7 additions and 7 deletions

View File

@ -103,17 +103,17 @@ namespace Slic3r
{ {
// change the color str to real colors // change the color str to real colors
std::vector<Color>used_filament_colors; std::vector<Color>used_filament_colors;
std::vector<std::vector<Color>>ams_filament_colors; std::vector<std::vector<Color>>ams_filament_colors(2);
for (auto& item : used_filament_colors_str) for (auto& item : used_filament_colors_str)
used_filament_colors.emplace_back(Color(item)); used_filament_colors.emplace_back(Color(item));
for (auto& arr : ams_filament_colors_str) {
std::vector<Color>tmp;
for (auto& item : arr)
tmp.emplace_back(Color(item));
ams_filament_colors.emplace_back(std::move(tmp));
}
for (size_t idx = 0; idx < ams_filament_colors_str.size(); ++idx) {
std::vector<Color> tmp;
for (auto& item : ams_filament_colors_str[idx])
tmp.emplace_back(Color(item));
ams_filament_colors[idx] = std::move(tmp);
}
int best_cost = std::numeric_limits<int>::max(); int best_cost = std::numeric_limits<int>::max();
std::vector<int>best_map; std::vector<int>best_map;