aboutsummaryrefslogtreecommitdiff
path: root/engines/hdb
diff options
context:
space:
mode:
authorEugene Sandulenko2019-09-20 21:54:44 +0200
committerEugene Sandulenko2019-09-20 21:55:08 +0200
commit9d028ac4accab47bbf05956b1cfccf3f482f2328 (patch)
tree17575f3a84f9a8e2db7cbbc9b179fb02536b2bcc /engines/hdb
parentd16e6a7d4968b4564b369c895e956a5ede38bf81 (diff)
downloadscummvm-rg350-9d028ac4accab47bbf05956b1cfccf3f482f2328.tar.gz
scummvm-rg350-9d028ac4accab47bbf05956b1cfccf3f482f2328.tar.bz2
scummvm-rg350-9d028ac4accab47bbf05956b1cfccf3f482f2328.zip
HDB: Guard for corrupted sound data
Diffstat (limited to 'engines/hdb')
-rw-r--r--engines/hdb/sound.cpp10
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(