mirror of
https://github.com/alsa-project/alsa-utils
synced 2024-11-10 00:35:42 +01:00
alsamixer: fix division by zero
The attempt to divide by max-min fails if a control has only one valid value. In this case, adjust the maximum so that the computation can succeed; the control will look like 0%. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
This commit is contained in:
parent
69c6bead43
commit
5a016b583b
1 changed files with 2 additions and 0 deletions
|
@ -462,6 +462,8 @@ static void display_control(unsigned int control_index)
|
|||
err = snd_mixer_selem_get_capture_volume_range(control->elem, &min, &max);
|
||||
if (err < 0)
|
||||
return;
|
||||
if (min == max)
|
||||
max = min + 1;
|
||||
|
||||
if (control->flags & IS_ACTIVE)
|
||||
wattrset(mixer_widget.window, 0);
|
||||
|
|
Loading…
Reference in a new issue