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.
This commit is contained in:
Wim Taymans 2022-05-07 15:58:39 +02:00
parent 0c8cd4ab52
commit 8afe5fe0f0

View file

@ -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) {