bu5hm4n pushed a commit to branch master.

http://git.enlightenment.org/core/enlightenment.git/commit/?id=56246e0f08abd69056fbd5495e7eb6e7398e43aa

commit 56246e0f08abd69056fbd5495e7eb6e7398e43aa
Author: Marcel Hollerbach <marcel-hollerb...@t-online.de>
Date:   Fri Apr 7 11:48:49 2017 +0200

    mixer: be prepared for sinks without any volume
    
    for the case that a sink does not have any volume we would access
    NULL[0], which leads to a crash, this fixes that.
    
    fix T5298
---
 src/modules/mixer/e_mod_main.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/modules/mixer/e_mod_main.c b/src/modules/mixer/e_mod_main.c
index 2c86915..c6cb6e5 100644
--- a/src/modules/mixer/e_mod_main.c
+++ b/src/modules/mixer/e_mod_main.c
@@ -200,6 +200,8 @@ _volume_increase_cb(E_Object *obj EINA_UNUSED, const char 
*params EINA_UNUSED)
    EINA_SAFETY_ON_NULL_RETURN(mixer_context->sink_default);
    Emix_Sink *s = (Emix_Sink *)mixer_context->sink_default;
 
+   if (!s->volume.channel_count) return;
+
    if (BARRIER_CHECK(s->volume.volumes[0], s->volume.volumes[0] + VOLUME_STEP))
      return;
 
@@ -758,8 +760,15 @@ _sink_event(int type, void *info)
      {
         if (mixer_context->sink_default == sink)
           {
+             int vol;
+
              _mixer_gadget_update();
-             _notify(sink->mute ? 0 : sink->volume.volumes[0]);
+             if (sink->mute || !sink->volume.channel_count)
+               vol = 0;
+             else
+               vol = sink->volume.volumes[0];
+
+             _notify(vol);
           }
      }
    else
@@ -833,7 +842,10 @@ _sink_input_get(int *volume, Eina_Bool *muted, void *data)
 
    input = data;
 
-   if (volume) *volume = input->volume.volumes[0];
+   if (input->volume.channel_count > 0)
+     {
+        if (volume) *volume = input->volume.volumes[0];
+     }
    if (muted) *muted = input->mute;
 }
 

-- 


Reply via email to