diff options
author | Ton Roosendaal <ton@blender.org> | 2010-12-01 20:47:38 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2010-12-01 20:47:38 +0300 |
commit | 3e214bd72c537067f8e96e08d9ac0653ba7a4b77 (patch) | |
tree | 3fc1a769c8ecba2f1e5dc0a7f5621d09536c7b79 | |
parent | f4205498a9854a5487a6b3531798690470f4bdcd (diff) |
Bugfix #24999
Array Modifier: edge indices could be equal to numVerts, causing
bad crashes in derivedmesh. Similar fix to previous here with
face indices. Should poke the coder of this... for now it survives OK.
-rw-r--r-- | source/blender/modifiers/intern/MOD_array.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/source/blender/modifiers/intern/MOD_array.c b/source/blender/modifiers/intern/MOD_array.c index c02ccd1fbcd..f371bfd5567 100644 --- a/source/blender/modifiers/intern/MOD_array.c +++ b/source/blender/modifiers/intern/MOD_array.c @@ -443,7 +443,13 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, } if(med.v1 == med.v2) continue; - + + /* XXX Unfortunately the calc_mapping returns sometimes numVerts... leads to bad crashes */ + if(med.v1 >= numVerts) + med.v1= numVerts-1; + if(med.v2 >= numVerts) + med.v2= numVerts-1; + if (initFlags) { med.flag |= ME_EDGEDRAW | ME_EDGERENDER; } @@ -460,9 +466,15 @@ static DerivedMesh *arrayModifier_doArray(ArrayModifierData *amd, { vert1 = calc_mapping(indexMap, inMED.v1, j); vert2 = calc_mapping(indexMap, inMED.v2, j); - + /* edge could collapse to single point after mapping */ if(vert1 == vert2) continue; + + /* XXX Unfortunately the calc_mapping returns sometimes numVerts... leads to bad crashes */ + if(vert1 >= numVerts) + vert1= numVerts-1; + if(vert2 >= numVerts) + vert2= numVerts-1; /* avoid duplicate edges */ if(!BLI_edgehash_haskey(edges, vert1, vert2)) { |