FIX: fix an exception happened in flush option in debug mode

Signed-off-by: yifan.wu <yifan.wu@bambulab.com>
Change-Id: I02847ac516f560863c126ee8bf7bfc9018c2d69e
This commit is contained in:
yifan.wu 2022-10-19 09:47:46 +08:00 committed by Lane.Wei
parent 0a4269f053
commit 65f57882b9
1 changed files with 9 additions and 1 deletions

View File

@ -963,7 +963,15 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
// we will sort objects so that dedicated for wiping are at the beginning:
ConstPrintObjectPtrs object_list = print.objects().vector();
std::sort(object_list.begin(), object_list.end(), [](const PrintObject* a, const PrintObject* b) { return a->config().flush_into_objects; });
// BBS: fix the exception caused by not fixed order between different objects
std::sort(object_list.begin(), object_list.end(), [object_list](const PrintObject* a, const PrintObject* b) {
if (a->config().flush_into_objects != b->config().flush_into_objects) {
return a->config().flush_into_objects.getBool();
}
else {
return a->id() < b->id();
}
});
// We will now iterate through
// - first the dedicated objects to mark perimeters or infills (depending on infill_first)