diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..b96a660
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,23 @@
+## Contributing to xNode
+đź’™Thank you for taking the time to contributeđź’™
+
+If you haven't already, join our [Discord channel](https://discord.gg/qgPrHv4)!
+
+## Pull Requests
+Try to keep your pull requests relevant, neat, and manageable. If you are adding multiple features, try splitting them into separate commits.
+* Avoid including irellevant whitespace or formatting changes.
+* Comment your code.
+* Spell check your code / comments
+
+## New features
+xNode aims to be simple and extendible, not trying to fix all of Unity's shortcomings.
+
+If your feature aims to cover something not related to editing nodes, it generally won't be accepted. If in doubt, ask on the Discord channel.
+
+## Coding conventions
+Skim through the code and you'll get the hang of it quickly.
+* Methods, Types and properties PascalCase
+* Variables camelCase
+* Public methods XML commented
+* Open braces on same line as condition
+* 4 spaces for indentation.
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; } }