diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2013-12-11 12:20:08 +0400 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2013-12-11 12:22:13 +0400 |
commit | c0b717b046804022bd0c3b45ffadf285746563ee (patch) | |
tree | 8fb0cf7746c5ff8b5d0673a5e96737ab958b14d0 /source/blender/makesrna/intern/rna_nodetree.c | |
parent | fcdc04af4f7c7c799dab5e5a38942ad6cc55b3d5 (diff) |
Sanity check in node links API: Make sure a valid node exists for both
sockets passed to the nodetree.links.new function, otherwise this could
lead to invalid connections between different node trees! The
ntreeAddLink function has asserts for this, but this condition needs to
be checked in the RNA method calling it.
Diffstat (limited to 'source/blender/makesrna/intern/rna_nodetree.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_nodetree.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/source/blender/makesrna/intern/rna_nodetree.c b/source/blender/makesrna/intern/rna_nodetree.c index 44334ce9aec..55989bd985c 100644 --- a/source/blender/makesrna/intern/rna_nodetree.c +++ b/source/blender/makesrna/intern/rna_nodetree.c @@ -793,6 +793,11 @@ static bNodeLink *rna_NodeTree_link_new(bNodeTree *ntree, ReportList *reports, nodeFindNode(ntree, fromsock, &fromnode, NULL); nodeFindNode(ntree, tosock, &tonode, NULL); + /* check validity of the sockets: + * if sockets from different trees are passed in this will fail! + */ + if (!fromnode || !tonode) + return NULL; if (&fromsock->in_out == &tosock->in_out) { BKE_report(reports, RPT_ERROR, "Same input/output direction of sockets"); |