Fix segfault in ensuring regularization - wrong check for unbounded access

This commit is contained in:
PavelMikus 2023-04-06 09:46:12 +02:00
parent b5514120e5
commit b1081d7ac3

View file

@ -1509,7 +1509,9 @@ void PrintObject::discover_vertical_shells()
Polygons internal_volume;
{
Polygons shrinked_bottom_slice = idx_layer > 0 ? to_polygons(m_layers[idx_layer - 1]->lslices) : Polygons{};
Polygons shrinked_upper_slice = idx_layer > 0 ? to_polygons(m_layers[idx_layer + 1]->lslices) : Polygons{};
Polygons shrinked_upper_slice = (idx_layer + 1) < m_layers.size() ?
to_polygons(m_layers[idx_layer + 1]->lslices) :
Polygons{};
internal_volume = intersection(shrinked_bottom_slice, shrinked_upper_slice);
}