audio: don't crash when changing volume if no audio is initialized

Oversight.
This commit is contained in:
wm4 2016-07-09 19:34:45 +02:00
parent 2fb2f9b93a
commit d47b708f00
1 changed files with 3 additions and 0 deletions

View File

@ -57,6 +57,9 @@ bool mixer_audio_initialized(struct mixer *mixer)
// Called when opts->softvol_volume or opts->softvol_mute were changed. // Called when opts->softvol_volume or opts->softvol_mute were changed.
void mixer_update_volume(struct mixer *mixer) void mixer_update_volume(struct mixer *mixer)
{ {
if (!mixer->af)
return;
float gain = MPMAX(mixer->opts->softvol_volume / 100.0, 0); float gain = MPMAX(mixer->opts->softvol_volume / 100.0, 0);
if (mixer->opts->softvol_mute == 1) if (mixer->opts->softvol_mute == 1)
gain = 0.0; gain = 0.0;