From: Philippe Proulx Date: Tue, 19 Mar 2019 18:39:17 +0000 (-0400) Subject: bt_port_output_message_iterator_create(): check that graph has no sinks X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=2bcba397e82f6691961fe70ebed36db8064358ac 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 --- 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: "