[Scummvm-git-logs] scummvm master -> c550f99a5887f2ab5818c4144d374b0d3150ae1b
moralrecordings
code at moral.net.au
Wed Jun 3 16:09:11 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
c550f99a58 DIRECTOR: Check for undefined audio data before playing
Commit: c550f99a5887f2ab5818c4144d374b0d3150ae1b
https://github.com/scummvm/scummvm/commit/c550f99a5887f2ab5818c4144d374b0d3150ae1b
Author: Scott Percival (code at moral.net.au)
Date: 2020-06-04T00:08:00+08:00
Commit Message:
DIRECTOR: Check for undefined audio data before playing
Changed paths:
engines/director/sound.cpp
diff --git a/engines/director/sound.cpp b/engines/director/sound.cpp
index 8cd5b0b3d2..ddfc1d4a0c 100644
--- a/engines/director/sound.cpp
+++ b/engines/director/sound.cpp
@@ -176,10 +176,16 @@ void DirectorSound::playCastMember(int castId, uint8 soundChannel, bool allowRep
warning("DirectorSound::playCastMember: no audio data attached to cast member %d", castId);
return;
}
+ Audio::AudioStream *as;
if (looping)
- playStream(*sd->getLoopingAudioStream(), soundChannel);
+ as = sd->getLoopingAudioStream();
else
- playStream(*sd->getAudioStream(), soundChannel);
+ as = sd->getAudioStream();
+ if (!as) {
+ warning("DirectorSound::playCastMember: audio data failed to load from cast");
+ return;
+ }
+ playStream(*as, soundChannel);
_channels[soundChannel - 1].lastPlayingCast = castId;
}
} else {
@@ -300,10 +306,14 @@ bool SNDDecoder::loadStream(Common::SeekableSubReadStreamEndian &stream) {
}
Audio::SeekableAudioStream *SNDDecoder::getAudioStream() {
+ if (!_data)
+ return nullptr;
return Audio::makeRawStream(_data, _size, _rate, _flags, DisposeAfterUse::NO);
}
Audio::AudioStream *SNDDecoder::getLoopingAudioStream() {
+ if (!_data)
+ return nullptr;
return new Audio::LoopingAudioStream(Audio::makeRawStream(_data, _size, _rate, _flags, DisposeAfterUse::NO), 0);
}
More information about the Scummvm-git-logs
mailing list