fix for crash copying nodes, regression since last release.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 26 Nov 2012 16:20:35 +0000 (16:20 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 26 Nov 2012 16:20:35 +0000 (16:20 +0000)
source/blender/blenkernel/intern/node.c

index 06b846a6df9ec86c8b08ab5626362dbc0bd1785b..e5500108f46746136efb3992edb5ec45420d3962 100644 (file)
@@ -406,13 +406,14 @@ bNode *nodeCopyNode(struct bNodeTree *ntree, struct bNode *node)
        
        /* only shader nodes get pleasant preview updating this way, compo uses own system */
        if (node->preview) {
-               if (ntree->type == NTREE_SHADER) {
+               if (ntree && (ntree->type == NTREE_SHADER)) {
                        nnode->preview = MEM_dupallocN(node->preview);
                        if (node->preview->rect)
                                nnode->preview->rect = MEM_dupallocN(node->preview->rect);
                }
-               else 
+               else {
                        nnode->preview = NULL;
+               }
        }
        
        if (ntree)