[Bf-blender-cvs] [6d95baf67ad] blender-v2.82-release: Fix T73364: crash calling particle_sytem.co_hair() on disabled particles

Brecht Van Lommel noreply at git.blender.org
Mon Feb 3 11:36:24 CET 2020


Commit: 6d95baf67ad3cbf8b65bc6e04059c822d8d097b9
Author: Brecht Van Lommel
Date:   Mon Feb 3 11:31:05 2020 +0100
Branches: blender-v2.82-release
https://developer.blender.org/rB6d95baf67ad3cbf8b65bc6e04059c822d8d097b9

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

===================================================================

M	source/blender/makesrna/intern/rna_particle.c

===================================================================

diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c
index 431f2c71e3f..36320be9270 100644
--- a/source/blender/makesrna/intern/rna_particle.c
+++ b/source/blender/makesrna/intern/rna_particle.c
@@ -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,



More information about the Bf-blender-cvs mailing list