Skip to content

Commit

Permalink
bf-cross-node-crash fixing a crash that happends when you try to pare…
Browse files Browse the repository at this point in the history
…nt a node to a key
  • Loading branch information
TomNCatz committed Feb 6, 2022
1 parent 3211e83 commit f07e1b6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions Code/NodeCode/MainView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -962,24 +962,32 @@ public void OnConnectionRequest( string from, int fromSlot, string to, int toSlo
var rightGraph = _graph.GetNode<SlottedGraphNode>( to );
Node rightSlot = rightGraph.GetSlot( toSlot );

if( leftSlot is KeyLinkSlot keyLink )
if( rightSlot is KeyAbstraction keyAbstraction )
{
if( !( rightSlot is KeySlot key ) )
if( !( leftSlot is KeyLinkSlot link ) )
{
throw new Exception($"{leftSlot.Name} is not a KeyLinkSlot");
_app.CatchException( new Exception($"{leftSlot.Name} is not a KeyLinkSlot"));
return;
}
if( !keyLink.AddKey( key.GetKey ) ) return;
if( !link.AddKey( keyAbstraction.GetKey ) ) return;

_graph.ConnectNode( @from, fromSlot, to, toSlot );

return;
}
else if( leftSlot is LinkToChildSlot leftLink )

if( leftSlot is LinkToChildSlot leftLink )
{
if( !( rightSlot is LinkToParentSlot rightLink) ) return;
if( !leftLink.LinkChild( rightGraph ) ) return;

rightLink.Link(leftLink);
_graph.ConnectNode( @from, fromSlot, to, toSlot );

return;
}

_app.CatchException( new Exception("Connection not compatible"));
}

private void OnDisconnectionRequest( string from, int fromSlot, string to, int toSlot)
Expand Down

0 comments on commit f07e1b6

Please sign in to comment.