Fixed crash on music volume change when no track is played using FluidSynth device

This commit is contained in:
alexey.lysiuk 2014-08-23 16:35:05 +03:00
parent 5364116354
commit 51d7340288
1 changed files with 2 additions and 2 deletions

View File

@ -540,7 +540,7 @@ bool MIDIStreamer::IsPlaying()
void MIDIStreamer::MusicVolumeChanged() void MIDIStreamer::MusicVolumeChanged()
{ {
if (MIDI->FakeVolume()) if (MIDI != NULL && MIDI->FakeVolume())
{ {
float realvolume = clamp<float>(snd_musicvolume * relative_volume, 0.f, 1.f); float realvolume = clamp<float>(snd_musicvolume * relative_volume, 0.f, 1.f);
Volume = clamp<DWORD>((DWORD)(realvolume * 65535.f), 0, 65535); Volume = clamp<DWORD>((DWORD)(realvolume * 65535.f), 0, 65535);
@ -622,7 +622,7 @@ void MIDIStreamer::FluidSettingStr(const char *setting, const char *value)
void MIDIStreamer::OutputVolume (DWORD volume) void MIDIStreamer::OutputVolume (DWORD volume)
{ {
if (MIDI->FakeVolume()) if (MIDI != NULL && MIDI->FakeVolume())
{ {
NewVolume = volume; NewVolume = volume;
VolumeChanged = true; VolumeChanged = true;