diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-03-26 11:20:37 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-03-26 11:20:37 +0300 |
commit | d97b97460ca9a28027041e5666dbfeb3a5295155 (patch) | |
tree | e07b8b0979e6060735ef1b15ea058b8cface8177 /source/blender/blenkernel/intern/mesh_evaluate.c | |
parent | b87eaef1f7928bd6f0e937474cf922afa4c07f83 (diff) |
Fix T44138: Crash in DataTransfer modifier when selecting a source with no loops.
Simply check and early return in case we have no source or destination items
(verts/edges/loops/polys) available...
Also, fix an assert in `BKE_mesh_calc_normals_poly()`, when called with no poly.
Diffstat (limited to 'source/blender/blenkernel/intern/mesh_evaluate.c')
-rw-r--r-- | source/blender/blenkernel/intern/mesh_evaluate.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/blenkernel/intern/mesh_evaluate.c b/source/blender/blenkernel/intern/mesh_evaluate.c index 6c835a72a40..ceb9b016ff2 100644 --- a/source/blender/blenkernel/intern/mesh_evaluate.c +++ b/source/blender/blenkernel/intern/mesh_evaluate.c @@ -226,7 +226,7 @@ void BKE_mesh_calc_normals_poly(MVert *mverts, int numVerts, MLoop *mloop, MPoly MPoly *mp; if (only_face_normals) { - BLI_assert(pnors != NULL); + BLI_assert((pnors != NULL) || (numPolys == 0)); #pragma omp parallel for if (numPolys > BKE_MESH_OMP_LIMIT) for (i = 0; i < numPolys; i++) { @@ -252,12 +252,12 @@ void BKE_mesh_calc_normals_poly(MVert *mverts, int numVerts, MLoop *mloop, MPoly } } - /* following Mesh convention; we use vertex coordinate itself for normal in this case */ for (i = 0; i < numVerts; i++) { MVert *mv = &mverts[i]; float *no = tnorms[i]; if (UNLIKELY(normalize_v3(no) == 0.0f)) { + /* following Mesh convention; we use vertex coordinate itself for normal in this case */ normalize_v3_v3(no, mv->co); } |