Fix T73364: crash calling particle_sytem.co_hair() on disabled particles

This commit is contained in:
Brecht Van Lommel 2020-02-03 11:31:05 +01:00
parent d237681cad
commit 6d95baf67a
Notes: blender-bot 2023-02-13 23:38:40 +01:00
Referenced by issue #73364, Crash when calling particle_sytem.co_hair() on disabled particles
1 changed files with 6 additions and 2 deletions

View File

@ -385,11 +385,11 @@ static void rna_ParticleSystem_co_hair(
totchild = 0;
}
if (particle_no < totpart) {
if (particle_no < totpart && particlesystem->pathcache) {
cache = particlesystem->pathcache[particle_no];
max_k = (int)cache->segments;
}
else if (particle_no < totpart + totchild) {
else if (particle_no < totpart + totchild && particlesystem->childcache) {
cache = particlesystem->childcache[particle_no - totpart];
if (cache->segments < 0) {
@ -400,6 +400,7 @@ static void rna_ParticleSystem_co_hair(
}
}
else {
zero_v3(n_co);
return;
}
@ -409,6 +410,9 @@ static void rna_ParticleSystem_co_hair(
mul_m4_v3(particlesystem->imat, n_co);
mul_m4_v3(object->obmat, n_co);
}
else {
zero_v3(n_co);
}
}
static const EnumPropertyItem *rna_Particle_Material_itemf(bContext *C,