From 8afe5fe0f0946ce4643835dc9db6b3a0822f7cd8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sat, 7 May 2022 15:58:39 +0200 Subject: [PATCH] filtet-chain: handle empty nodes When there are no nodes, we can't make links. This avoids getting into an infinite loop when trying to find ports. --- src/modules/module-filter-chain.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/modules/module-filter-chain.c b/src/modules/module-filter-chain.c index 206fec3f3..1a77d9ce2 100644 --- a/src/modules/module-filter-chain.c +++ b/src/modules/module-filter-chain.c @@ -1351,6 +1351,11 @@ static int parse_link(struct graph *graph, struct spa_json *json) struct port *in_port, *out_port; struct link *link; + if (spa_list_is_empty(&graph->node_list)) { + pw_log_error("can't make links in graph without nodes"); + return -EINVAL; + } + while (spa_json_get_string(json, key, sizeof(key)) > 0) { if (spa_streq(key, "output")) { if (spa_json_get_string(json, output, sizeof(output)) <= 0) {