safety check when making a node local- make sure its already in the node tree.
authorCampbell Barton <ideasman42@gmail.com>
Mon, 11 Jun 2012 19:12:45 +0000 (19:12 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 11 Jun 2012 19:12:45 +0000 (19:12 +0000)
source/blender/makesrna/intern/rna_nodetree.c

index 5ffdfe6d71dc588ca73698674abf17a070999c8e..ca61b5328627dee9eaa9119b90b581cadd037b5b 100644 (file)
@@ -644,8 +644,9 @@ static PointerRNA rna_NodeTree_active_node_get(PointerRNA *ptr)
 static void rna_NodeTree_active_node_set(PointerRNA *ptr, PointerRNA value)
 {
        bNodeTree *ntree = (bNodeTree *)ptr->data;
 static void rna_NodeTree_active_node_set(PointerRNA *ptr, PointerRNA value)
 {
        bNodeTree *ntree = (bNodeTree *)ptr->data;
-       if (value.data)
-               nodeSetActive(ntree, (bNode *)value.data);
+       bNode *node = (bNode *)value.data;
+       if (node && BLI_findindex(&ntree->nodes, node) != -1)
+               nodeSetActive(ntree, node);
        else
                nodeClearActive(ntree);
 }
        else
                nodeClearActive(ntree);
 }