From 453eb5bdc70513464c7137f910cba815289c97a0 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 26 Apr 2019 16:38:14 -0400 Subject: Don't let a node that hasn't been added to the graph be added as an edge target --- python/flowgraph.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'python') diff --git a/python/flowgraph.py b/python/flowgraph.py index 3054ff35..58add8b0 100644 --- a/python/flowgraph.py +++ b/python/flowgraph.py @@ -268,8 +268,13 @@ class FlowGraphNode(object): :param BranchType edge_type: Type of edge to add :param FlowGraphNode target: Target node object """ + if not target.is_valid_for_graph(self.graph): + raise ValueError("Target of edge has not been added to the owning graph") core.BNAddFlowGraphNodeOutgoingEdge(self.handle, edge_type, target.handle) + def is_valid_for_graph(self, graph): + return core.BNIsNodeValidForFlowGraph(graph.handle, self.handle) + class FlowGraphLayoutRequest(object): def __init__(self, graph, callback = None): -- cgit v1.3.1