diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2016-04-08 17:26:42 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2016-04-08 17:26:42 +0300 |
commit | c1d1c1dc6b9b1e3d01ea9b8acacd235c1a357500 (patch) | |
tree | e03b9253164c9ecd08cd18e36c05a7e215308b87 /source/blender/blenkernel | |
parent | a5dcda8ad34fcb16af6f65946d7175e00dae27e0 (diff) |
Fix T48088: Reproducible crash: Edges + Array Mod + Hair Particles.
Code did not consider the possibility to have no face at all! :P
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/intern/particle.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/source/blender/blenkernel/intern/particle.c b/source/blender/blenkernel/intern/particle.c index 0b8853364d6..098700495a0 100644 --- a/source/blender/blenkernel/intern/particle.c +++ b/source/blender/blenkernel/intern/particle.c @@ -1422,7 +1422,6 @@ int psys_particle_dm_face_lookup( { MFace *mtessface_final; OrigSpaceFace *osface_final; - int totface_final; int pindex_orig; float uv[2], (*faceuv)[2]; @@ -1430,6 +1429,13 @@ int psys_particle_dm_face_lookup( const int *index_mf_to_mpoly = NULL; const int *index_mp_to_orig = NULL; + const int totface_final = dm_final->getNumTessFaces(dm_final); + const int totface_deformed = dm_deformed ? dm_deformed->getNumTessFaces(dm_deformed) : totface_final; + + if (ELEM(0, totface_final, totface_deformed)) { + return DMCACHE_NOTFOUND; + } + index_mf_to_mpoly = dm_final->getTessFaceDataArray(dm_final, CD_ORIGINDEX); index_mp_to_orig = dm_final->getPolyDataArray(dm_final, CD_ORIGINDEX); BLI_assert(index_mf_to_mpoly); @@ -1451,11 +1457,6 @@ int psys_particle_dm_face_lookup( index_mf_to_mpoly_deformed = NULL; - totface_final = dm_final->getNumTessFaces(dm_final); - if (!totface_final) { - return DMCACHE_NOTFOUND; - } - mtessface_final = dm_final->getTessFaceArray(dm_final); osface_final = dm_final->getTessFaceDataArray(dm_final, CD_ORIGSPACE); |