1
0
mirror of https://github.com/Siccity/xNode.git synced 2026-02-06 07:14:56 +08:00

Fix potential error when copying a NodeGraph with null nodes

This commit is contained in:
Thor Brigsted 2018-04-07 18:47:28 +02:00
parent 1885d453a4
commit 588fc0d80a

View File

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