From b1ae7d5edae2f91ae59075ee135f0f2238327836 Mon Sep 17 00:00:00 2001 From: itsmattkc <34096995+itsmattkc@users.noreply.github.com> Date: Sun, 23 Jan 2022 14:51:04 -0800 Subject: [PATCH] node: fixed catastrophic array bug Jesus Christ how did this not get caught sooner --- app/node/node.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/node/node.cpp b/app/node/node.cpp index d2ad25f30..fa2aacc8b 100644 --- a/app/node/node.cpp +++ b/app/node/node.cpp @@ -755,7 +755,7 @@ void Node::InputArrayInsert(const QString &id, int index, bool undoable) // Move connections down InputConnections copied_edges = input_connections(); for (auto it=copied_edges.crbegin(); it!=copied_edges.crend(); it++) { - if (it->first.element() >= index) { + if (it->first.input() == id && it->first.element() >= index) { // Disconnect this and reconnect it one element down NodeInput new_edge = it->first; new_edge.set_element(new_edge.element() + 1); @@ -802,7 +802,7 @@ void Node::InputArrayRemove(const QString &id, int index, bool undoable) // Move connections up InputConnections copied_edges = input_connections(); for (auto it=copied_edges.cbegin(); it!=copied_edges.cend(); it++) { - if (it->first.element() >= index) { + if (it->first.input() == id && it->first.element() >= index) { // Disconnect this and reconnect it one element up if it's not the element being removed DisconnectEdge(it->second, it->first);