[#19229] 1 line fix resolves - segmentation Fault
authorCampbell Barton <ideasman42@gmail.com>
Sat, 22 Aug 2009 17:11:36 +0000 (17:11 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Sat, 22 Aug 2009 17:11:36 +0000 (17:11 +0000)
from Martin Frances (martinfrances)

Added a scene check when appending objects so you can append data without a scene.

source/blender/blenloader/intern/readfile.c

index 72aba02f723910531b9a27af2891d362fd849a28..77b51d950b937195c5201e80f99b0d81d7b1a7f3 100644 (file)
@@ -3093,7 +3093,7 @@ static void direct_link_particlesystems(FileData *fd, ListBase *particles)
                        psys->flag &= ~PSYS_KEYED;
                }
 
-               if(psys->particles->boid) {
+               if(psys->particles && psys->particles->boid) {
                        pa = psys->particles;
                        pa->boid = newdataadr(fd, pa->boid);
                        for(a=1,pa++; a<psys->totpart; a++, pa++)
@@ -10804,14 +10804,16 @@ static Library* library_append(Main *mainvar, Scene *scene, char* file, char *di
        fix_relpaths_library(G.sce, mainvar); /* make all relative paths, relative to the open blend file */
 
        /* give a base to loose objects. If group append, do it for objects too */
-       if(idcode==ID_GR) {
-               if (flag & FILE_LINK) {
-                       give_base_to_objects(mainvar, scene, NULL, 0);
+       if(scene) {
+               if(idcode==ID_GR) {
+                       if (flag & FILE_LINK) {
+                               give_base_to_objects(mainvar, scene, NULL, 0);
+                       } else {
+                               give_base_to_objects(mainvar, scene, curlib, 1);
+                       }       
                } else {
-                       give_base_to_objects(mainvar, scene, curlib, 1);
-               }       
-       } else {
-               give_base_to_objects(mainvar, scene, NULL, 0);
+                       give_base_to_objects(mainvar, scene, NULL, 0);
+               }
        }
        /* has been removed... erm, why? s..ton) */
        /* 20040907: looks like they are give base already in append_named_part(); -Nathan L */