Fix T40733: Segfault with hair particles cache and vgroups.

The "fix" is just a stupid index sanity check to avoid crashing. Underlying issue is not identified and probably never will ...
This commit is contained in:
Lukas Tönne 2014-06-29 15:51:58 +02:00
parent ccfe845ff4
commit d8b0470fd0
Notes: blender-bot 2023-02-14 10:28:16 +01:00
Referenced by issue #40733, Segfault with hair particles cache and vgroups
1 changed files with 3 additions and 0 deletions

View File

@ -2666,6 +2666,9 @@ static void psys_thread_create_path(ParticleThread *thread, struct ChildParticle
/* get the original coordinates (orco) for texture usage */
cpa_from = part->from;
cpa_num = pa->num;
/* XXX hack to avoid messed up particle num and subsequent crash (#40733) */
if (cpa_num > ctx->sim.psmd->dm->getNumTessFaces(ctx->sim.psmd->dm))
cpa_num = 0;
cpa_fuv = pa->fuv;
psys_particle_on_emitter(ctx->sim.psmd, cpa_from, cpa_num, DMCACHE_ISCHILD, cpa_fuv, pa->foffset, co, ornor, 0, 0, orco, 0);