mirror of
https://github.com/rm-code/Graphoon.git
synced 2024-11-16 18:24:22 +00:00
Check if target nodes exist when an edge is added
This commit is contained in:
parent
6c0bd6b50a
commit
0feff6c970
@ -96,6 +96,8 @@ function Graph.new()
|
|||||||
-- @param target - The node id to which the edge is pointing to.
|
-- @param target - The node id to which the edge is pointing to.
|
||||||
--
|
--
|
||||||
function self:connectIDs( originID, targetID )
|
function self:connectIDs( originID, targetID )
|
||||||
|
assert( nodes[originID], string.format( "Tried to add an Edge to the nonexistent Node \"%s\".", originID ));
|
||||||
|
assert( nodes[targetID], string.format( "Tried to add an Edge to the nonexistent Node \"%s\".", targetID ));
|
||||||
addEdge( nodes[originID], nodes[targetID] );
|
addEdge( nodes[originID], nodes[targetID] );
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user