Fix T39078: crash increasing hair emission number

This commit is contained in:
Campbell Barton 2014-03-11 23:04:59 +11:00
parent ced595a37d
commit 500088d9e3
Notes: blender-bot 2023-02-14 11:01:35 +01:00
Referenced by issue #39078, Blender 2.70 crash when increasing hair emission number
1 changed files with 5 additions and 0 deletions

View File

@ -2397,6 +2397,11 @@ void psys_find_parents(ParticleSimulationData *sim)
if ((sim->psys->renderdata || G.is_rendering) && part->child_nbr && part->ren_child_nbr)
totparent *= (float)part->child_nbr / (float)part->ren_child_nbr;
/* hard limit, workaround for it being ignored above */
if (sim->psys->totpart < totparent) {
totparent = sim->psys->totpart;
}
tree = BLI_kdtree_new(totparent);
for (p = 0, cpa = sim->psys->child; p < totparent; p++, cpa++) {