mirror of
https://github.com/Siccity/xNode.git
synced 2026-02-06 15:24:55 +08:00
Fix potential error when copying a NodeGraph with null nodes
This commit is contained in:
parent
1885d453a4
commit
588fc0d80a
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user