aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2004-02-03 08:53:13 +0000
committerMax Horn2004-02-03 08:53:13 +0000
commitf36710f8b4e5d28517fdcb35ac4fefbd15734be7 (patch)
tree357832b8aec085f1a188a4950d794c2202fac0ae
parent43efc8bed0d908357c2bb0d0c626cdaba9cb35a8 (diff)
downloadscummvm-rg350-f36710f8b4e5d28517fdcb35ac4fefbd15734be7.tar.gz
scummvm-rg350-f36710f8b4e5d28517fdcb35ac4fefbd15734be7.tar.bz2
scummvm-rg350-f36710f8b4e5d28517fdcb35ac4fefbd15734be7.zip
Act more gracefully when failing to load a (VOC) sound (should help bug #889442)
svn-id: r12719
-rw-r--r--scumm/sound.cpp5
-rw-r--r--sound/voc.cpp6
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);
}