Fix T93563: Crash subdividing with overlapping tri and quad

The first loop was left out when finding the split edge boundary.

Error from f2138686d9.
This commit is contained in:
Campbell Barton 2021-12-02 22:39:27 +11:00
parent 42a6b2fd06
commit 0f89d05848
Notes: blender-bot 2023-02-14 05:16:25 +01:00
Referenced by issue #88449: Blender LTS: Maintenance Task 2.93
Referenced by issue #88449, Blender LTS: Maintenance Task 2.93
Referenced by issue #93563, Subdividing with overlapping tri and quad crashes Blender
Referenced by issue #93479, 3.0 Potential candidates for corrective releases
Referenced by issue #77348, Blender LTS: Maintenance Task 2.83
1 changed files with 4 additions and 2 deletions

View File

@ -1187,12 +1187,14 @@ void bmo_subdivide_edges_exec(BMesh *bm, BMOperator *op)
vlen = BLI_array_len(loops);
/* find the boundary of one of the split edges */
for (a = 1; a < vlen; a++) {
if (!BMO_vert_flag_test(bm, loops[a - 1]->v, ELE_INNER) &&
for (a = 0; a < vlen; a++) {
if (!BMO_vert_flag_test(bm, loops[a ? (a - 1) : (vlen - 1)]->v, ELE_INNER) &&
BMO_vert_flag_test(bm, loops[a]->v, ELE_INNER)) {
break;
}
}
/* Failure to break means there is an internal error. */
BLI_assert(a < vlen);
if (BMO_vert_flag_test(bm, loops[(a + numcuts + 1) % vlen]->v, ELE_INNER)) {
b = (a + numcuts + 1) % vlen;