Fix: Crash when using loop select on edge that has only 1 face #108759

Merged
Christoph Lendenfeld merged 1 commits from ChrisLend/blender:fix_paint_face_loop_crash into main 2023-06-08 15:24:26 +02:00
1 changed files with 6 additions and 3 deletions

View File

@ -503,7 +503,7 @@ void paintface_select_loop(bContext *C, Object *ob, const int mval[2], const boo
edge_to_poly_map,
polys_to_select);
if (!traced_full_loop) {
if (!traced_full_loop && polys_to_closest_edge.size() > 1) {
/* Trace the other way. */
follow_face_loop(polys_to_closest_edge[1],
closest_edge_index,
@ -519,8 +519,11 @@ void paintface_select_loop(bContext *C, Object *ob, const int mval[2], const boo
/* Toggling behavior. When one of the faces of the picked edge is already selected,
* it deselects the loop instead. */
const bool select_toggle = select && !(select_poly.span[polys_to_closest_edge[0]] ||
select_poly.span[polys_to_closest_edge[1]]);
bool any_adjacent_poly_selected = false;
for (const int i : polys_to_closest_edge) {
any_adjacent_poly_selected |= select_poly.span[i];
}
const bool select_toggle = select && !any_adjacent_poly_selected;
select_poly.span.fill_indices(polys_to_select.as_span(), select_toggle);
select_poly.finish();