diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-03-31 22:22:30 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-03-31 22:27:35 +0300 |
commit | 83b5f0268ef766ccc97c89cc6efe2b8a95f7dddc (patch) | |
tree | 63f139afbcc833b07d1a8e6aaced662fd29505e9 /source/blender/bmesh/intern/bmesh_polygon_edgenet.c | |
parent | 553ea6de8b57c682a5bc7e9169860d95e659af1d (diff) |
Fix T48012: Knife Project crash
Diffstat (limited to 'source/blender/bmesh/intern/bmesh_polygon_edgenet.c')
-rw-r--r-- | source/blender/bmesh/intern/bmesh_polygon_edgenet.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c index 508a9e660f3..c224a1ad587 100644 --- a/source/blender/bmesh/intern/bmesh_polygon_edgenet.c +++ b/source/blender/bmesh/intern/bmesh_polygon_edgenet.c @@ -1485,12 +1485,26 @@ finally: #ifdef USE_PARTIAL_CONNECT /* don't free 'vert_temp_pair_list', its part of the arena */ if (use_partial_connect) { + + /* Sanity check: ensure we don't have connecting edges before splicing begins. */ +#ifdef DEBUG + { + struct TempVertPair *tvp = temp_vert_pairs.list; + do { + /* we must _never_ create connections here + * (inface the islands can't have a connection at all) */ + BLI_assert(BM_edge_exists(tvp->v_orig, tvp->v_temp) == NULL); + } while ((tvp = tvp->next)); + } +#endif + struct TempVertPair *tvp = temp_vert_pairs.list; do { - /* we must _never_ create connections here - * (inface the islands can't have a connection at all) */ - BLI_assert(BM_edge_exists(tvp->v_orig, tvp->v_temp) == NULL); - BM_vert_splice(bm, tvp->v_orig, tvp->v_temp); + /* its _very_ unlikely the edge exists, + * however splicing may case this. see: T48012 */ + if (!BM_edge_exists(tvp->v_orig, tvp->v_temp)) { + BM_vert_splice(bm, tvp->v_orig, tvp->v_temp); + } } while ((tvp = tvp->next)); /* Remove edges which have become doubles since splicing vertices together, |