[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16555] trunk/blender/source/blender/ blenloader/intern/readfile.c: Added check for failing linking of a ID_PA block.

Ton Roosendaal ton at blender.org
Tue Sep 16 18:21:45 CEST 2008


Revision: 16555
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16555
Author:   ton
Date:     2008-09-16 18:20:51 +0200 (Tue, 16 Sep 2008)

Log Message:
-----------
Added check for failing linking of a ID_PA block.

Modified Paths:
--------------
    trunk/blender/source/blender/blenloader/intern/readfile.c

Modified: trunk/blender/source/blender/blenloader/intern/readfile.c
===================================================================
--- trunk/blender/source/blender/blenloader/intern/readfile.c	2008-09-16 15:41:13 UTC (rev 16554)
+++ trunk/blender/source/blender/blenloader/intern/readfile.c	2008-09-16 16:20:51 UTC (rev 16555)
@@ -2598,18 +2598,27 @@
 
 static void lib_link_particlesystems(FileData *fd, ID *id, ListBase *particles)
 {
-	ParticleSystem *psys;
+	ParticleSystem *psys, *psysnext;
 	int a;
 
-	for(psys=particles->first; psys; psys=psys->next){
+	for(psys=particles->first; psys; psys=psysnext){
 		ParticleData *pa;
+		
+		psysnext= psys->next;
+		
 		psys->part = newlibadr_us(fd, id->lib, psys->part);
-		psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
-		psys->keyed_ob = newlibadr(fd, id->lib, psys->keyed_ob);
+		if(psys->part) {
+			psys->target_ob = newlibadr(fd, id->lib, psys->target_ob);
+			psys->keyed_ob = newlibadr(fd, id->lib, psys->keyed_ob);
 
-		for(a=0,pa=psys->particles; a<psys->totpart; a++,pa++){
-			pa->stick_ob=newlibadr(fd, id->lib, pa->stick_ob);
+			for(a=0,pa=psys->particles; a<psys->totpart; a++,pa++){
+				pa->stick_ob=newlibadr(fd, id->lib, pa->stick_ob);
+			}
 		}
+		else {
+			BLI_remlink(particles, psys);
+			MEM_freeN(psys);
+		}
 	}
 }
 static void direct_link_particlesystems(FileData *fd, ListBase *particles)





More information about the Bf-blender-cvs mailing list