summaryrefslogtreecommitdiff
path: root/python/flowgraph.py
diff options
context:
space:
mode:
authorRusty Wagner <rusty@vector35.com>2019-04-26 16:38:14 -0400
committerRusty Wagner <rusty@vector35.com>2019-04-26 16:38:14 -0400
commit453eb5bdc70513464c7137f910cba815289c97a0 (patch)
tree2bdf1ebdaf00748fcf631d58486afe97d6da3197 /python/flowgraph.py
parent0911788d1183d061eabe1d9084d4eb866c032938 (diff)
Don't let a node that hasn't been added to the graph be added as an edge target
Diffstat (limited to 'python/flowgraph.py')
-rw-r--r--python/flowgraph.py5
1 files changed, 5 insertions, 0 deletions
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):