1
0
mirror of https://github.com/Siccity/xNode.git synced 2025-12-21 01:36:03 +08:00

Fixed IndexOutOfRangeException issue #29

This commit is contained in:
Thor Brigsted 2018-04-09 09:36:42 +02:00
parent 588fc0d80a
commit 9ce5496b62

View File

@ -187,10 +187,14 @@ namespace XNodeEditor {
if (draggedOutputTarget != null) { if (draggedOutputTarget != null) {
XNode.Node node = draggedOutputTarget.node; XNode.Node node = draggedOutputTarget.node;
if (graph.nodes.Count != 0) draggedOutput.Connect(draggedOutputTarget); if (graph.nodes.Count != 0) draggedOutput.Connect(draggedOutputTarget);
// ConnectionIndex can be -1 if the connection is removed instantly after creation
int connectionIndex = draggedOutput.GetConnectionIndex(draggedOutputTarget); int connectionIndex = draggedOutput.GetConnectionIndex(draggedOutputTarget);
draggedOutput.GetReroutePoints(connectionIndex).AddRange(draggedOutputReroutes); if (connectionIndex != -1) {
if (NodeEditor.onUpdateNode != null) NodeEditor.onUpdateNode(node); draggedOutput.GetReroutePoints(connectionIndex).AddRange(draggedOutputReroutes);
EditorUtility.SetDirty(graph); if (NodeEditor.onUpdateNode != null) NodeEditor.onUpdateNode(node);
EditorUtility.SetDirty(graph);
}
} }
//Release dragged connection //Release dragged connection
draggedOutput = null; draggedOutput = null;