From 588fc0d80a965cae821423cdb8ae6f0440afc660 Mon Sep 17 00:00:00 2001 From: Thor Brigsted Date: Sat, 7 Apr 2018 18:47:28 +0200 Subject: [PATCH] Fix potential error when copying a NodeGraph with null nodes --- Scripts/NodeGraph.cs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Scripts/NodeGraph.cs b/Scripts/NodeGraph.cs index 09010dc..32310d2 100644 --- a/Scripts/NodeGraph.cs +++ b/Scripts/NodeGraph.cs @@ -51,6 +51,7 @@ namespace XNode { NodeGraph graph = Instantiate(this); // Instantiate all nodes inside the graph for (int i = 0; i < nodes.Count; i++) { + if (nodes[i] == null) continue; Node node = Instantiate(nodes[i]) as Node; node.graph = graph; graph.nodes[i] = node; @@ -58,6 +59,7 @@ namespace XNode { // Redirect all connections for (int i = 0; i < graph.nodes.Count; i++) { + if (graph.nodes[i] == null) continue; foreach (NodePort port in graph.nodes[i].Ports) { port.Redirect(nodes, graph.nodes); }