Fix T59074: BMesh intersect hangs
authorCampbell Barton <ideasman42@gmail.com>
Thu, 20 Dec 2018 06:50:36 +0000 (17:50 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 20 Dec 2018 06:50:36 +0000 (17:50 +1100)
This is a degenerate intersection, exit early instead of hanging.

source/blender/bmesh/intern/bmesh_polygon_edgenet.c

index 4703dbf3bcd05f3bc254c0f023cb9219c6091c90..53874e4ed967f48751952cdd428163c5a6c9df30 100644 (file)
@@ -1162,7 +1162,16 @@ static BMVert *bm_face_split_edgenet_partial_connect(BMesh *bm, BMVert *v_delimi
                BM_elem_flag_enable(v_split, VERT_NOT_IN_STACK);
 
                BLI_assert(v_delimit->e != NULL);
+
+               /* Degenerate, avoid eternal loop, see: T59074. */
+#if 0
                BLI_assert(v_split->e != NULL);
+#else
+               if (UNLIKELY(v_split->e == NULL)) {
+                       BM_vert_kill(bm, v_split);
+                       v_split = NULL;
+               }
+#endif
        }
 
        /* Restore flags */