From 2bcba397e82f6691961fe70ebed36db8064358ac Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Tue, 19 Mar 2019 14:39:17 -0400 Subject: [PATCH] bt_port_output_message_iterator_create(): check that graph has no sinks The graph must not have any sink component when calling bt_port_output_message_iterator_create() because the purpose of an output port message iterator is to iterator the messages of a source or a filter component. Signed-off-by: Philippe Proulx --- lib/graph/iterator.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/graph/iterator.c b/lib/graph/iterator.c index 01c21128..11f17dcd 100644 --- a/lib/graph/iterator.c +++ b/lib/graph/iterator.c @@ -750,6 +750,8 @@ bt_port_output_message_iterator_create(struct bt_graph *graph, (void *) graph, "Output port is not part of graph: %![graph-]+g, %![port-]+p", graph, output_port); + BT_ASSERT_PRE(!graph->has_sink, + "Graph already has a sink component: %![graph-]+g"); /* Create message iterator */ BT_LIB_LOGD("Creating message iterator on output port: " -- 2.34.1