summaryrefslogtreecommitdiffstats
path: root/audio/mixer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-07-09 19:34:45 +0200
committerwm4 <wm4@nowhere>2016-07-09 19:34:45 +0200
commitd47b708f00663a09df743e3dadf0cf366ecdb4c0 (patch)
tree91f647a583078704364aa01492d1244dbd26a13c /audio/mixer.c
parent2fb2f9b93a8ae3d275603311b7fad255cbaf3ab6 (diff)
downloadmpv-d47b708f00663a09df743e3dadf0cf366ecdb4c0.tar.bz2
mpv-d47b708f00663a09df743e3dadf0cf366ecdb4c0.tar.xz
audio: don't crash when changing volume if no audio is initialized
Oversight.
Diffstat (limited to 'audio/mixer.c')
-rw-r--r--audio/mixer.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/audio/mixer.c b/audio/mixer.c
index a251a5aa60..a58a814649 100644
--- a/audio/mixer.c
+++ b/audio/mixer.c
@@ -57,6 +57,9 @@ bool mixer_audio_initialized(struct mixer *mixer)
// Called when opts->softvol_volume or opts->softvol_mute were changed.
void mixer_update_volume(struct mixer *mixer)
{
+ if (!mixer->af)
+ return;
+
float gain = MPMAX(mixer->opts->softvol_volume / 100.0, 0);
if (mixer->opts->softvol_mute == 1)
gain = 0.0;