diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-01-20 03:24:11 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-01-20 03:24:11 +0100 |
commit | 936862362c30c22f42f33bd717b5f915f9c04657 (patch) | |
tree | 8d0fa97cf85001418d78e0f74312c76ee3e02da7 /src/pulse | |
parent | 67fcc760930960b5f7494287ce3ad422de31f99c (diff) |
don't divide by zero if no left resp. no right channels are defined
Diffstat (limited to 'src/pulse')
-rw-r--r-- | src/pulse/volume.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/pulse/volume.c b/src/pulse/volume.c index 9191a074..10a44daf 100644 --- a/src/pulse/volume.c +++ b/src/pulse/volume.c @@ -424,8 +424,15 @@ static void get_avg_lr(const pa_channel_map *map, const pa_cvolume *v, pa_volume } } - *l = left / n_left; - *r = right / n_right; + if (n_left <= 0) + *l = PA_VOLUME_NORM; + else + *l = left / n_left; + + if (n_right <= 0) + *r = PA_VOLUME_NORM; + else + *r = right / n_right; } float pa_cvolume_get_balance(const pa_channel_map *map, const pa_cvolume *v) { |