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) {
|
||||
_direction = IO.Input;
|
||||
_connectionType = (attribs[i] as Node.InputAttribute).connectionType;
|
||||
}
|
||||
else if (attribs[i] is Node.OutputAttribute) {
|
||||
} else if (attribs[i] is Node.OutputAttribute) {
|
||||
_direction = IO.Output;
|
||||
_connectionType = (attribs[i] as Node.OutputAttribute).connectionType;
|
||||
}
|
||||
@ -225,15 +224,17 @@ namespace XNode {
|
||||
connections.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
// Remove the other ports connection to this port
|
||||
for (int i = 0; i < port.connections.Count; i++) {
|
||||
if (port.connections[i].Port == this) {
|
||||
port.connections.RemoveAt(i);
|
||||
if (port != null) {
|
||||
// Remove the other ports connection to this port
|
||||
for (int i = 0; i < port.connections.Count; i++) {
|
||||
if (port.connections[i].Port == this) {
|
||||
port.connections.RemoveAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Trigger OnRemoveConnection
|
||||
node.OnRemoveConnection(this);
|
||||
port.node.OnRemoveConnection(port);
|
||||
if (port != null) port.node.OnRemoveConnection(port);
|
||||
}
|
||||
|
||||
public void ClearConnections() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user