mixer: Fix segfault when backend does not have any sink
authorMarcel Hollerbach <marcel-hollerbach@t-online.de>
Mon, 10 Aug 2015 17:23:53 +0000 (19:23 +0200)
committerMarcel Hollerbach <marcel-hollerbach@t-online.de>
Mon, 10 Aug 2015 17:25:27 +0000 (19:25 +0200)
src/modules/mixer/e_mod_main.c

index 113da66..ea204db 100644 (file)
@@ -638,7 +638,10 @@ _sink_event(int type, void *info)
         if (sink == mixer_context->sink_default)
           {
              l = emix_sinks_get();
-             mixer_context->sink_default = l->data;
+             if (l)
+               mixer_context->sink_default = l->data;
+             else
+               mixer_context->sink_default = NULL;
              _mixer_gadget_update();
           }
      }
@@ -669,7 +672,10 @@ _ready(void)
    if (emix_sink_default_support())
      mixer_context->sink_default = emix_sink_default_get();
    else
-     mixer_context->sink_default = emix_sinks_get()->data;
+     {
+        if (emix_sinks_get())
+          mixer_context->sink_default = emix_sinks_get()->data;
+     }
 
    _mixer_gadget_update();
 }