diff --git a/src/Engine/GraphLayout/GraphLayout.cs b/src/Engine/GraphLayout/GraphLayout.cs index 0405e8ad210..4d948775faf 100644 --- a/src/Engine/GraphLayout/GraphLayout.cs +++ b/src/Engine/GraphLayout/GraphLayout.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; @@ -108,6 +108,9 @@ public void AddNode(Guid guid, double width, double height, double x, double y, /// The y coordinate of the connector's right end point. public void AddEdge(Guid startId, Guid endId, double startX, double startY, double endX, double endY) { + //Validates that the two nodes that will be used to create the Edge exist + if (!Nodes.Where(node => node.Id == startId).Any() || !Nodes.Where(node => node.Id == endId).Any()) return; + var edge = new Edge(startId, endId, startX, startY, endX, endY, this); Edges.Add(edge); }