Act more gracefully when failing to load a (VOC) sound (should help bug #889442)

svn-id: r12719
This commit is contained in:
Max Horn 2004-02-03 08:53:13 +00:00
parent 43efc8bed0
commit f36710f8b4
2 changed files with 11 additions and 0 deletions

View File

@ -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);

View File

@ -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);
}