From d47b708f00663a09df743e3dadf0cf366ecdb4c0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 Jul 2016 19:34:45 +0200 Subject: audio: don't crash when changing volume if no audio is initialized Oversight. --- audio/mixer.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'audio') 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; -- cgit v1.2.3