Particles: should fix crash on startup
authorDaniel Genrich <daniel.genrich@gmx.net>
Wed, 12 Aug 2009 11:12:20 +0000 (11:12 +0000)
committerDaniel Genrich <daniel.genrich@gmx.net>
Wed, 12 Aug 2009 11:12:20 +0000 (11:12 +0000)
source/blender/blenkernel/intern/pointcache.c

index 7aa01de71d0785436c84f11e38c3eb78e5bfa262..649c26242ce53c8fb30f73fc1b1c60f1e3eaef62 100644 (file)
@@ -443,18 +443,21 @@ void BKE_ptcache_id_from_particles(PTCacheID *pid, Object *ob, ParticleSystem *p
 
        pid->data_types= (1<<BPHYS_DATA_LOCATION) | (1<<BPHYS_DATA_VELOCITY);
 
-       /* TODO for later */
-       //if((psys->part->flag & (PART_UNBORN|PART_DIED))==0)
-       //      pid->data_types|= (1<<BPHYS_DATA_INDEX);
+       if(psys->part)
+       {
+               /* TODO for later */
+               //if((psys->part->flag & (PART_UNBORN|PART_DIED))==0)
+               //      pid->data_types|= (1<<BPHYS_DATA_INDEX);
 
-       if(psys->part->phystype == PART_PHYS_BOIDS)
-               pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION) | (1<<BPHYS_DATA_BOIDS);
+               if(psys->part->phystype == PART_PHYS_BOIDS)
+                       pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION) | (1<<BPHYS_DATA_BOIDS);
 
-       if(psys->part->rotmode || psys->part->avemode)
-               pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION);
+               if(psys->part->rotmode || psys->part->avemode)
+                       pid->data_types|= (1<<BPHYS_DATA_AVELOCITY) | (1<<BPHYS_DATA_ROTATION);
 
-       if(psys->part->flag & PART_ROT_DYN)
-               pid->data_types|= (1<<BPHYS_DATA_ROTATION);
+               if(psys->part->flag & PART_ROT_DYN)
+                       pid->data_types|= (1<<BPHYS_DATA_ROTATION);
+       }
 
        pid->info_types= (1<<BPHYS_DATA_TIMES);
 }