diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-07-21 19:22:11 +0400 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-07-21 19:22:11 +0400 |
commit | 44160c97474215d7ed71b2b03bb971889ce4b18e (patch) | |
tree | 5e6bfa696cb118517fcf0179f405bc154fb0823c /source/blender | |
parent | ff00aa1b7ea71c44177762a72c23835af16073d2 (diff) |
Fix #20196: division by zero in edge slide with two overlapping loops.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/transform/transform.c | 5 | ||||
-rw-r--r-- | source/blender/editors/transform/transform_input.c | 6 |
2 files changed, 6 insertions, 5 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index beea3c9bee4..86fdb81e0d9 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -4780,10 +4780,11 @@ int doEdgeSlide(TransInfo *t, float perc) //Non prop code look = vertlist; while(look) { - float newlen; + float newlen, edgelen; ev = look->link; tempsv = BLI_ghash_lookup(vertgh,ev); - newlen = (len / len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co)); + edgelen = len_v3v3(editedge_getOtherVert(tempsv->up,ev)->co,editedge_getOtherVert(tempsv->down,ev)->co); + newlen = (edgelen != 0.0f)? (len / edgelen): 0.0f; if(newlen > 1.0) {newlen = 1.0;} if(newlen < 0.0) {newlen = 0.0;} if(flip == 0) { diff --git a/source/blender/editors/transform/transform_input.c b/source/blender/editors/transform/transform_input.c index d7ebd28f604..b7cb34802cc 100644 --- a/source/blender/editors/transform/transform_input.c +++ b/source/blender/editors/transform/transform_input.c @@ -197,17 +197,17 @@ void InputCustomRatio(TransInfo *t, MouseInput *mi, short mval[2], float output[ mdx = (mi->precision_mval[0] + (float)(mval[0] - mi->precision_mval[0]) / 10.0f) - data[2]; mdy = (mi->precision_mval[1] + (float)(mval[1] - mi->precision_mval[1]) / 10.0f) - data[3]; - distance = (mdx*dx + mdy*dy) / length; + distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f; } else { short mdx, mdy; mdx = mval[0] - data[2]; mdy = mval[1] - data[3]; - distance = (mdx*dx + mdy*dy) / length; + distance = (length != 0.0f)? (mdx*dx + mdy*dy) / length: 0.0f; } - output[0] = distance / length; + output[0] = (length != 0.0f)? distance / length: 0.0f; } } |