Node merge: fix crash loading files with unknown nodes (e.g. cycles files).
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 6 Sep 2011 17:34:56 +0000 (17:34 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Tue, 6 Sep 2011 17:34:56 +0000 (17:34 +0000)
source/blender/blenkernel/intern/node.c
source/blender/blenloader/intern/readfile.c

index cd1a6e6115109fcaec5c9b955a9491d56822cf73..47fc72f5e526908374215daa8befbb50ebd82245 100644 (file)
@@ -1524,9 +1524,11 @@ void NodeTagChanged(bNodeTree *ntree, bNode *node)
 {
        bNodeTreeType *ntreetype = ntreeGetType(ntree->type);
        
-       if (ntreetype->update_node)
+       /* extra null pointer checks here because this is called when unlinking
+          unknown nodes on file load, so typeinfo pointers may not be set */
+       if (ntreetype && ntreetype->update_node)
                ntreetype->update_node(ntree, node);
-       else if (node->typeinfo->updatefunc)
+       else if (node->typeinfo && node->typeinfo->updatefunc)
                node->typeinfo->updatefunc(ntree, node);
 }
 
index d1a19f24b9706dbb664df28e841b40568cba5e6d..664148157cbeb5435024350ff18e0e49e2803be9 100644 (file)
@@ -2217,8 +2217,9 @@ static void direct_link_nodetree(FileData *fd, bNodeTree *ntree)
                if(node->type == NODE_DYNAMIC) {
                        node->custom1= 0;
                        node->custom1= BSET(node->custom1, NODE_DYNAMIC_LOADED);
-                       node->typeinfo= NULL;
                }
+
+               node->typeinfo= NULL;
                
                link_list(fd, &node->inputs);
                link_list(fd, &node->outputs);