forked from bartvdbraak/blender
Fix for own mistake in r61178: bNodeTree->links ListBase was being modified while iterating ...
This commit is contained in:
parent
9a78cda321
commit
53fffbafbe
@ -401,22 +401,27 @@ static void node_remove_extra_links(SpaceNode *snode, bNodeLink *link)
|
|||||||
bNodeSocket *from = link->fromsock, *to = link->tosock;
|
bNodeSocket *from = link->fromsock, *to = link->tosock;
|
||||||
int max_from = from->limit, max_to = to->limit;
|
int max_from = from->limit, max_to = to->limit;
|
||||||
int count_from = 1, count_to = 1; /* start at 1, link is included */
|
int count_from = 1, count_to = 1; /* start at 1, link is included */
|
||||||
bNodeLink *tlink;
|
bNodeLink *tlink, *tlink_next;
|
||||||
|
|
||||||
for (tlink = ntree->links.first; tlink; tlink = tlink->next) {
|
for (tlink = ntree->links.first; tlink; tlink = tlink_next) {
|
||||||
|
tlink_next = tlink->next;
|
||||||
if (tlink == link)
|
if (tlink == link)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (tlink->fromsock == from) {
|
if (tlink && tlink->fromsock == from) {
|
||||||
++count_from;
|
++count_from;
|
||||||
if (count_from > max_from)
|
if (count_from > max_from) {
|
||||||
nodeRemLink(ntree, tlink);
|
nodeRemLink(ntree, tlink);
|
||||||
|
tlink = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tlink->tosock == to) {
|
if (tlink && tlink->tosock == to) {
|
||||||
++count_to;
|
++count_to;
|
||||||
if (count_to > max_to)
|
if (count_to > max_to) {
|
||||||
nodeRemLink(ntree, tlink);
|
nodeRemLink(ntree, tlink);
|
||||||
|
tlink = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user