Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DYN-7110 Fix crash when connecting nodes #15340

Merged
merged 3 commits into from
Jun 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/DynamoCoreWpf/ViewModels/Core/StateMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,17 @@ internal void BeginConnection(Guid nodeId, int portIndex, PortType portType)
{
bool isInPort = portType == PortType.Input;

if (!(Model.GetModelInternal(nodeId) is NodeModel node)) return;
PortModel portModel = isInPort ? node.InPorts[portIndex] : node.OutPorts[portIndex];
if (Model.GetModelInternal(nodeId) is not NodeModel node) return;
PortModel portModel;
try
{
portModel = isInPort ? node.InPorts[portIndex] : node.OutPorts[portIndex];
}
catch(Exception ex)
{
this.DynamoViewModel.Model.Logger.Log("Failed to make connection: " + ex.Message);
return;
}

// Test if port already has a connection, if so grab it and begin connecting
// to somewhere else (we don't allow the grabbing of the start connector).
Expand All @@ -197,7 +206,7 @@ internal void BeginConnection(Guid nodeId, int portIndex, PortType portType)
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine(ex.Message);
this.DynamoViewModel.Model.Logger.Log(ex.Message);
}
}
}
Expand Down
Loading