diff options
author | Eugene Sandulenko | 2019-09-20 21:54:44 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-20 21:55:08 +0200 |
commit | 9d028ac4accab47bbf05956b1cfccf3f482f2328 (patch) | |
tree | 17575f3a84f9a8e2db7cbbc9b179fb02536b2bcc | |
parent | d16e6a7d4968b4564b369c895e956a5ede38bf81 (diff) | |
download | scummvm-rg350-9d028ac4accab47bbf05956b1cfccf3f482f2328.tar.gz scummvm-rg350-9d028ac4accab47bbf05956b1cfccf3f482f2328.tar.bz2 scummvm-rg350-9d028ac4accab47bbf05956b1cfccf3f482f2328.zip |
HDB: Guard for corrupted sound data
-rw-r--r-- | engines/hdb/sound.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/engines/hdb/sound.cpp b/engines/hdb/sound.cpp index 842b145894..4579212937 100644 --- a/engines/hdb/sound.cpp +++ b/engines/hdb/sound.cpp @@ -1538,6 +1538,11 @@ void Sound::playSound(int index) { audioStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES); } + if (audioStream == 0) { + warning("playSound: sound %d is corrupt", index); + return; + } + g_hdb->_mixer->playStream( Audio::Mixer::kSFXSoundType, &_handles[soundChannel], @@ -1597,6 +1602,11 @@ void Sound::playSoundEx(int index, int channel, bool loop) { audioStream = Audio::makeWAVStream(stream, DisposeAfterUse::YES); } + if (audioStream == 0) { + warning("playSoundEx: sound %d is corrupt", index); + return; + } + if (loop) { Audio::AudioStream *loopingStream = new Audio::LoopingAudioStream(audioStream, 0, DisposeAfterUse::YES); g_hdb->_mixer->playStream( |