aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/titanic/sound/audio_buffer.cpp1
-rw-r--r--engines/titanic/sound/wave_file.cpp3
2 files changed, 3 insertions, 1 deletions
diff --git a/engines/titanic/sound/audio_buffer.cpp b/engines/titanic/sound/audio_buffer.cpp
index 1f0693181a..636f4a5107 100644
--- a/engines/titanic/sound/audio_buffer.cpp
+++ b/engines/titanic/sound/audio_buffer.cpp
@@ -27,6 +27,7 @@ namespace Titanic {
CAudioBuffer::CAudioBuffer(int maxSize) : _finished(false) {
_data.resize(maxSize);
+ reset();
}
void CAudioBuffer::reset() {
diff --git a/engines/titanic/sound/wave_file.cpp b/engines/titanic/sound/wave_file.cpp
index b094adbafe..c9205c76ac 100644
--- a/engines/titanic/sound/wave_file.cpp
+++ b/engines/titanic/sound/wave_file.cpp
@@ -171,7 +171,8 @@ void CWaveFile::load(byte *data, uint dataSize) {
// Parse the wave header
Common::MemoryReadStream wavStream(data, dataSize, DisposeAfterUse::NO);
- Audio::loadWAVFromStream(wavStream, _dataSize, _rate, _flags, &_wavType);
+ if (!Audio::loadWAVFromStream(wavStream, _dataSize, _rate, _flags, &_wavType))
+ error("Invalid wave file");
_headerSize = wavStream.pos();
}