modules:mixer: Avoid pa backend from crash
authorFlavio Ceolin <flavio.ceolin@gmail.com>
Sat, 24 Oct 2015 02:22:48 +0000 (00:22 -0200)
committerFlavio Ceolin <flavio.ceolin@gmail.com>
Sat, 24 Oct 2015 21:10:40 +0000 (19:10 -0200)
Check the pulseaudio's context error and if info is not null before
get server's information.

src/modules/mixer/lib/backends/pulseaudio/pulse.c

index 9122735..da83487 100644 (file)
@@ -549,6 +549,14 @@ _server_info_cb(pa_context *c, const pa_server_info *info,
 {
    pa_operation *o;
 
+   if (pa_context_errno(c) != PA_OK)
+     {
+        WRN("Could not get pa server info, error: %d", pa_context_errno(c));
+        return;
+     }
+
+   EINA_SAFETY_ON_NULL_RETURN(info);
+
    if (!(o = pa_context_get_sink_info_by_name(c, info->default_sink_name,
                                               _sink_default_cb, userdata)))
      {