From 2a951a3002aa7a7136a62bcc2754e16009223157 Mon Sep 17 00:00:00 2001 From: Thor Brigsted Date: Fri, 9 Feb 2018 14:29:18 +0100 Subject: [PATCH] Fixed Connection returning null when non-nulls exist. --- Scripts/NodePort.cs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Scripts/NodePort.cs b/Scripts/NodePort.cs index c017534..b609066 100644 --- a/Scripts/NodePort.cs +++ b/Scripts/NodePort.cs @@ -9,8 +9,15 @@ namespace XNode { public enum IO { Input, Output } public int ConnectionCount { get { return connections.Count; } } - /// Return the first connection - public NodePort Connection { get { return connections.Count > 0 ? connections[0].Port : null; } } + /// Return the first non-null connection + public NodePort Connection { + get { + for (int i = 0; i < connections.Count; i++) { + if (connections[i] != null) return connections[i].Port; + } + return null; + } + } public IO direction { get { return _direction; } } public Node.ConnectionType connectionType { get { return _connectionType; } }