From 87a5ce06f349f3c79b4f6ae1c75c35987776f69e Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Mon, 14 Dec 2009 13:11:22 +0000 Subject: Fix #20372: crash when strand render enabled with child hairs. --- source/blender/render/intern/source/convertblender.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'source/blender/render') diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index d0f7b2d60a5..c89811a62e0 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -1707,14 +1707,8 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem totface= psmd->dm->getNumFaces(psmd->dm); origindex= psmd->dm->getFaceDataArray(psmd->dm, CD_ORIGINDEX); - if(origindex) { - for(a=0; atotbound= MAX2(strandbuf->totbound, origindex[a]); - } - else { - for(a=0; atotbound= MAX2(strandbuf->totbound, a); - } + for(a=0; atotbound= MAX2(strandbuf->totbound, (origindex)? origindex[a]: a); strandbuf->totbound++; strandbuf->bound= MEM_callocN(sizeof(StrandBound)*strandbuf->totbound, "StrandBound"); @@ -1856,8 +1850,10 @@ static int render_new_particle_system(Render *re, ObjectRen *obr, ParticleSystem dosimplify = psys_render_simplify_params(psys, cpa, simplify); if(strandbuf) { - if(origindex[cpa->num]+1 > sbound - strandbuf->bound) { - sbound= strandbuf->bound + origindex[cpa->num]+1; + int orignum= (origindex)? origindex[cpa->num]: cpa->num; + + if(orignum > sbound - strandbuf->bound) { + sbound= strandbuf->bound + orignum; sbound->start= sbound->end= obr->totstrand; } } -- cgit v1.2.3