fix for possible (but unlikely) crash.

added NULL check in case nodeAddNodeType() is given an invalid type or the dynamic node cant be found.
This commit is contained in:
Campbell Barton
2011-04-23 08:02:29 +00:00
parent 7faa531a62
commit 176e45f88e

View File

@@ -967,6 +967,11 @@ bNode *nodeAddNodeType(bNodeTree *ntree, int type, bNodeTree *ngroup, ID *id)
} else
ntype= node_get_type(ntree, type, id);
if(ntype == NULL) {
printf("nodeAddNodeType() error: '%d' type invalid\n", type);
return NULL;
}
node= MEM_callocN(sizeof(bNode), "new node");
BLI_addtail(&ntree->nodes, node);
node->typeinfo= ntype;