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
This commit is contained in:
Philipp Oeser 2021-03-09 18:23:02 +01:00
parent cf2933c38a
commit 79bc4962d3
Notes: blender-bot 2023-02-13 23:39:48 +01:00
Referenced by issue #86416, Crash in node menu of the texture properties
1 changed files with 8 additions and 0 deletions

View File

@ -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;