Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2020-10-22 07:26:22 +0300
committerCampbell Barton <ideasman42@gmail.com>2020-10-22 07:26:22 +0300
commitc53ac5e1c488628f75133df81d7f7484ec89ae9a (patch)
tree587d45621bd35c2bc3ed17528a43e5840ce901df /source
parentc70650785bffb5f111c3c81c7c37dff4d5a9a446 (diff)
Fix T81939: crash calling bmesh.utils.vert_separate()
Missing NULL check in bmesh_kernel_vert_separate.
Diffstat (limited to 'source')
-rw-r--r--source/blender/bmesh/intern/bmesh_core.c86
1 files changed, 43 insertions, 43 deletions
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index d5ebc73dc1e..df5e7aadc64 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2343,60 +2343,60 @@ void bmesh_kernel_vert_separate(
BLI_assert(!BM_ELEM_API_FLAG_TEST(e_iter, EDGE_VISIT));
BM_ELEM_API_FLAG_ENABLE(e_iter, EDGE_VISIT);
} while ((e_iter = bmesh_disk_edge_next(e_iter, v)) != e_first);
- }
-
- while (true) {
- /* Considering only edges and faces incident on vertex v, walk
- * the edges & collect in the 'edges' list for splitting */
- BMEdge *e = v->e;
- BM_ELEM_API_FLAG_DISABLE(e, EDGE_VISIT);
+ while (true) {
+ /* Considering only edges and faces incident on vertex v, walk
+ * the edges & collect in the 'edges' list for splitting */
- do {
- BLI_assert(!BM_ELEM_API_FLAG_TEST(e, EDGE_VISIT));
- BLI_SMALLSTACK_PUSH(edges, e);
- edges_found += 1;
+ BMEdge *e = v->e;
+ BM_ELEM_API_FLAG_DISABLE(e, EDGE_VISIT);
- if (e->l) {
- BMLoop *l_iter, *l_first;
- l_iter = l_first = e->l;
- do {
- BMLoop *l_adjacent = (l_iter->v == v) ? l_iter->prev : l_iter->next;
- BLI_assert(BM_vert_in_edge(l_adjacent->e, v));
- if (BM_ELEM_API_FLAG_TEST(l_adjacent->e, EDGE_VISIT)) {
- BM_ELEM_API_FLAG_DISABLE(l_adjacent->e, EDGE_VISIT);
- BLI_SMALLSTACK_PUSH(edges_search, l_adjacent->e);
- }
- } while ((l_iter = l_iter->radial_next) != l_first);
- }
- } while ((e = BLI_SMALLSTACK_POP(edges_search)));
+ do {
+ BLI_assert(!BM_ELEM_API_FLAG_TEST(e, EDGE_VISIT));
+ BLI_SMALLSTACK_PUSH(edges, e);
+ edges_found += 1;
+
+ if (e->l) {
+ BMLoop *l_iter, *l_first;
+ l_iter = l_first = e->l;
+ do {
+ BMLoop *l_adjacent = (l_iter->v == v) ? l_iter->prev : l_iter->next;
+ BLI_assert(BM_vert_in_edge(l_adjacent->e, v));
+ if (BM_ELEM_API_FLAG_TEST(l_adjacent->e, EDGE_VISIT)) {
+ BM_ELEM_API_FLAG_DISABLE(l_adjacent->e, EDGE_VISIT);
+ BLI_SMALLSTACK_PUSH(edges_search, l_adjacent->e);
+ }
+ } while ((l_iter = l_iter->radial_next) != l_first);
+ }
+ } while ((e = BLI_SMALLSTACK_POP(edges_search)));
- /* now we have all edges connected to 'v->e' */
+ /* now we have all edges connected to 'v->e' */
- BLI_assert(edges_found <= v_edges_num);
+ BLI_assert(edges_found <= v_edges_num);
- if (edges_found == v_edges_num) {
- /* We're done! The remaining edges in 'edges' form the last fan,
- * which can be left as is.
- * if 'edges' were alloc'd it'd be freed here. */
- break;
- }
+ if (edges_found == v_edges_num) {
+ /* We're done! The remaining edges in 'edges' form the last fan,
+ * which can be left as is.
+ * if 'edges' were alloc'd it'd be freed here. */
+ break;
+ }
- BMVert *v_new;
+ BMVert *v_new;
- v_new = BM_vert_create(bm, v->co, v, BM_CREATE_NOP);
- if (copy_select) {
- BM_elem_select_copy(bm, v_new, v);
- }
+ v_new = BM_vert_create(bm, v->co, v, BM_CREATE_NOP);
+ if (copy_select) {
+ BM_elem_select_copy(bm, v_new, v);
+ }
- while ((e = BLI_SMALLSTACK_POP(edges))) {
- bmesh_edge_vert_swap(e, v_new, v);
- }
+ while ((e = BLI_SMALLSTACK_POP(edges))) {
+ bmesh_edge_vert_swap(e, v_new, v);
+ }
- if (r_vout) {
- BLI_SMALLSTACK_PUSH(verts_new, v_new);
+ if (r_vout) {
+ BLI_SMALLSTACK_PUSH(verts_new, v_new);
+ }
+ verts_num += 1;
}
- verts_num += 1;
}
#undef EDGE_VISIT