Duplicating viewer node crashed in cases; bad ID was given to a function.
Fix provided by Alexander Kuznetsov. Thanks!
This commit is contained in:
2011-01-08 19:12:42 +00:00
parent 16e7a26185
commit 17e733a4fc

View File

@@ -330,6 +330,7 @@ void ED_node_texture_default(Tex *tx)
ntreeSolveOrder(tx->nodetree); /* needed for pointers */
}
/* id is supposed to contain a node tree */
void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *treetype)
{
bNode *node= NULL;
@@ -347,6 +348,10 @@ void node_tree_from_ID(ID *id, bNodeTree **ntree, bNodeTree **edittree, int *tre
*ntree= ((Tex*)id)->nodetree;
if(treetype) *treetype= NTREE_TEXTURE;
}
else {
if(treetype) *treetype= 0;
return;
}
/* find editable group */
if(edittree) {
@@ -1521,7 +1526,7 @@ static int node_duplicate_exec(bContext *C, wmOperator *UNUSED(op))
for(node= snode->edittree->nodes.first; node; node= node->next)
if(node->flag & SELECT)
if(node->id)
ED_node_changed_update(node->id, node);
ED_node_changed_update(snode->id, node);
ntreeSolveOrder(snode->edittree);
node_tree_verify_groups(snode->nodetree);