From 143af979ab61fba97d5563d66cd205a3ebaca725 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 7 May 2026 13:30:41 +0200 Subject: [PATCH] filter-graph: error when there are no valid nodes The nodes might have failed to load or there was an empty array or the array did not contain objects. --- spa/plugins/filter-graph/filter-graph.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spa/plugins/filter-graph/filter-graph.c b/spa/plugins/filter-graph/filter-graph.c index 9e304c36b..cab91e11e 100644 --- a/spa/plugins/filter-graph/filter-graph.c +++ b/spa/plugins/filter-graph/filter-graph.c @@ -2290,6 +2290,10 @@ static int load_graph(struct graph *graph, const struct spa_dict *props) if ((res = load_node(graph, &it[1])) < 0) return res; } + if (spa_list_is_empty(&graph->node_list)) { + spa_log_error(impl->log, "filter.graph has no nodes"); + return -EINVAL; + } if (plinks != NULL) { while (spa_json_enter_object(plinks, &it[1]) > 0) { if ((res = parse_link(graph, &it[1])) < 0) @@ -2354,7 +2358,6 @@ static int load_graph(struct graph *graph, const struct spa_dict *props) else graph->default_outputs = last->desc->n_output; - return 0; }