From 1255d88969674c1b2da3b6ae3642ba2799b47201 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 24 Apr 2024 15:40:28 +0200 Subject: [PATCH] context: handle NULL data loops It's possible that the data loop failed to initialize and we should try to avoid segfaulting on that. --- src/pipewire/context.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 86494483c..7d1cd017c 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -117,8 +117,9 @@ static int context_set_freewheel(struct pw_context *context, bool freewheel) int res = 0; for (i = 0; i < impl->n_data_loops; i++) { - if ((thr = pw_data_loop_get_thread(impl->data_loops[i].impl)) == NULL) - return -EIO; + if (impl->data_loops[i].impl == NULL || + (thr = pw_data_loop_get_thread(impl->data_loops[i].impl)) == NULL) + continue; if (freewheel) { pw_log_info("%p: enter freewheel", context);