diff options
-rw-r--r-- | scumm/sound.cpp | 5 | ||||
-rw-r--r-- | sound/voc.cpp | 6 |
2 files changed, 11 insertions, 0 deletions
diff --git a/scumm/sound.cpp b/scumm/sound.cpp index b66c70a406..05a5210c3d 100644 --- a/scumm/sound.cpp +++ b/scumm/sound.cpp @@ -830,6 +830,11 @@ void Sound::startSfxSound(File *file, int file_size, PlayingSoundHandle *handle, } else { input = makeVOCStream(_sfxFile); } + + if (!input) { + warning("startSfxSound failed to load sound"); + return 0; + } if (_vm->_imuseDigital) { //_vm->_imuseDigital->stopSound(kTalkSoundID); diff --git a/sound/voc.cpp b/sound/voc.cpp index 80027fb143..ef1741111f 100644 --- a/sound/voc.cpp +++ b/sound/voc.cpp @@ -156,6 +156,9 @@ AudioStream *makeVOCStream(byte *ptr) { int size, rate, loops; byte *data = readVOCFromMemory(ptr, size, rate, loops); + if (!data) + return 0; + return makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, data, size, 0, 0); } @@ -163,6 +166,9 @@ AudioStream *makeVOCStream(File *file) { int size, rate; byte *data = loadVOCFile(file, size, rate); + if (!data) + return 0; + return makeLinearInputStream(rate, SoundMixer::FLAG_AUTOFREE | SoundMixer::FLAG_UNSIGNED, data, size, 0, 0); } |