diff options
author | Dan Glastonbury <[email protected]> | 2018-03-06 14:54:52 +1000 |
---|---|---|
committer | Dan Glastonbury <[email protected]> | 2018-03-06 14:54:52 +1000 |
commit | 18a29a7a5e0a50601ef49bddbd6d3bb4d572aa37 (patch) | |
tree | 3b37aab71c77d7ecfd378029a44402eda0b55714 | |
parent | 34354eb36226a0d65aa187f82e9326faae293dd7 (diff) | |
download | cubeb-pulse-get-server-info-null.tar.gz cubeb-pulse-get-server-info-null.zip |
pulse: Handle info == NULL in pa_context_get_server_info callbacks.pulse-get-server-info-null
A bit of defensive programming. An ASSERT that info != NULL fires in
the rust version of the pulse back end. Adding here for
completeness.
-rw-r--r-- | src/cubeb_pulse.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cubeb_pulse.c b/src/cubeb_pulse.c index 1cac5ea..055bc5f 100644 --- a/src/cubeb_pulse.c +++ b/src/cubeb_pulse.c @@ -177,7 +177,15 @@ sink_info_callback(pa_context * context, const pa_sink_info * info, int eol, voi static void server_info_callback(pa_context * context, const pa_server_info * info, void * u) { + cubeb * ctx = u; pa_operation * o; + + if (!info) { + // If info is NULL, the pa_context_get_server_info command timed out. + WRAP(pa_threaded_mainloop_signal)(ctx->mainloop, 0); + return; + } + o = WRAP(pa_context_get_sink_info_by_name)(context, info->default_sink_name, sink_info_callback, u); if (o) { WRAP(pa_operation_unref)(o); |