From 79bc4962d376a37356752334d43021a18fbdba5b Mon Sep 17 00:00:00 2001 From: Philipp Oeser Date: Tue, 9 Mar 2021 18:23:02 +0100 Subject: Fix T86416: geometry nodes crash choosing a group node link menu Since rBb279fef85d1a, the nodes properties for geometry nodes using a texture are displayed in the Properties Editor. It was possible to create recursive nodetrees when choosing the 'root' nodegroup in the node link menu though leading to a crash. Now poll if a group node of a particular node could actually be added to the current tree. Also check if the tree types actually match. Maniphest Tasks: T86416 Differential Revision: https://developer.blender.org/D10671 --- source/blender/editors/space_node/node_templates.c | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_node/node_templates.c b/source/blender/editors/space_node/node_templates.c index b0c0f660717..3873985d93a 100644 --- a/source/blender/editors/space_node/node_templates.c +++ b/source/blender/editors/space_node/node_templates.c @@ -330,6 +330,10 @@ static void ui_node_link_items(NodeLinkArg *arg, int i; for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) { + if ((ngroup->type != arg->ntree->type) || !nodeGroupPoll(arg->ntree, ngroup)) { + continue; + } + ListBase *lb = ((in_out == SOCK_IN) ? &ngroup->inputs : &ngroup->outputs); totitems += BLI_listbase_count(lb); } @@ -339,6 +343,10 @@ static void ui_node_link_items(NodeLinkArg *arg, i = 0; for (ngroup = arg->bmain->nodetrees.first; ngroup; ngroup = ngroup->id.next) { + if ((ngroup->type != arg->ntree->type) || !nodeGroupPoll(arg->ntree, ngroup)) { + continue; + } + ListBase *lb = (in_out == SOCK_IN ? &ngroup->inputs : &ngroup->outputs); bNodeSocket *stemp; int index; -- cgit v1.2.3