mirror of
https://github.com/Siccity/xNode.git
synced 2025-12-20 09:16:01 +08:00
Fixed NullRefEx when trying to disconnect a null NodePort
This commit is contained in:
parent
51e77a2279
commit
1b2f94607e
@ -54,8 +54,7 @@ namespace XNode {
|
|||||||
if (attribs[i] is Node.InputAttribute) {
|
if (attribs[i] is Node.InputAttribute) {
|
||||||
_direction = IO.Input;
|
_direction = IO.Input;
|
||||||
_connectionType = (attribs[i] as Node.InputAttribute).connectionType;
|
_connectionType = (attribs[i] as Node.InputAttribute).connectionType;
|
||||||
}
|
} else if (attribs[i] is Node.OutputAttribute) {
|
||||||
else if (attribs[i] is Node.OutputAttribute) {
|
|
||||||
_direction = IO.Output;
|
_direction = IO.Output;
|
||||||
_connectionType = (attribs[i] as Node.OutputAttribute).connectionType;
|
_connectionType = (attribs[i] as Node.OutputAttribute).connectionType;
|
||||||
}
|
}
|
||||||
@ -225,15 +224,17 @@ namespace XNode {
|
|||||||
connections.RemoveAt(i);
|
connections.RemoveAt(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Remove the other ports connection to this port
|
if (port != null) {
|
||||||
for (int i = 0; i < port.connections.Count; i++) {
|
// Remove the other ports connection to this port
|
||||||
if (port.connections[i].Port == this) {
|
for (int i = 0; i < port.connections.Count; i++) {
|
||||||
port.connections.RemoveAt(i);
|
if (port.connections[i].Port == this) {
|
||||||
|
port.connections.RemoveAt(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Trigger OnRemoveConnection
|
// Trigger OnRemoveConnection
|
||||||
node.OnRemoveConnection(this);
|
node.OnRemoveConnection(this);
|
||||||
port.node.OnRemoveConnection(port);
|
if (port != null) port.node.OnRemoveConnection(port);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearConnections() {
|
public void ClearConnections() {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user