diff options
author | Howard Trickey <howard.trickey@gmail.com> | 2013-11-06 19:27:19 +0400 |
---|---|---|
committer | Howard Trickey <howard.trickey@gmail.com> | 2013-11-06 19:27:19 +0400 |
commit | 3143536b08708bbbf1d8dfdfff705ad5d5afedfb (patch) | |
tree | 6190c31f8c3a1e7dfcc21fbcf478b1f883e868da /source/blender/editors | |
parent | 3e6c3698882475698a879d8eff99f094874017b6 (diff) |
Fix knife bug exposed by valgrind.
Was reading cage coordinate from those of existing
BMVerts even for newly created verts that don't
have cage coordinates there.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/mesh/editmesh_knife.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/source/blender/editors/mesh/editmesh_knife.c b/source/blender/editors/mesh/editmesh_knife.c index f961b6aefe9..32d17f6c599 100644 --- a/source/blender/editors/mesh/editmesh_knife.c +++ b/source/blender/editors/mesh/editmesh_knife.c @@ -348,12 +348,17 @@ static KnifeVert *new_knife_vert(KnifeTool_OpData *kcd, const float co[3], const static KnifeVert *get_bm_knife_vert(KnifeTool_OpData *kcd, BMVert *v) { KnifeVert *kfv = BLI_ghash_lookup(kcd->origvertmap, v); + const float *cageco; if (!kfv) { BMIter bmiter; BMFace *f; - kfv = new_knife_vert(kcd, v->co, kcd->cagecos[BM_elem_index_get(v)]); + if (BM_elem_index_get(v) >= 0) + cageco = kcd->cagecos[BM_elem_index_get(v)]; + else + cageco = v->co; + kfv = new_knife_vert(kcd, v->co, cageco); kfv->v = v; BLI_ghash_insert(kcd->origvertmap, v, kfv); BM_ITER_ELEM (f, &bmiter, v, BM_FACES_OF_VERT) { |