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.
This commit is contained in:
Wim Taymans 2026-05-07 13:30:41 +02:00
parent e9aff3040a
commit 143af979ab

View file

@ -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;
}