diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/decoders/flac.cpp | 8 | ||||
-rw-r--r-- | sound/decoders/mp3.cpp | 1 | ||||
-rw-r--r-- | sound/decoders/vorbis.cpp | 8 |
3 files changed, 15 insertions, 2 deletions
diff --git a/sound/decoders/flac.cpp b/sound/decoders/flac.cpp index 93233e2cb5..a75873be64 100644 --- a/sound/decoders/flac.cpp +++ b/sound/decoders/flac.cpp @@ -729,7 +729,13 @@ void FlacInputStream::callWrapError(const ::FLAC__SeekableStreamDecoder *decoder SeekableAudioStream *makeFlacStream( Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) { - return new FlacInputStream(stream, disposeAfterUse); + SeekableAudioStream *s = new FlacInputStream(stream, disposeAfterUse); + if (s && s->endOfData()) { + delete s; + return 0; + } else { + return s; + } } } // End of namespace Audio diff --git a/sound/decoders/mp3.cpp b/sound/decoders/mp3.cpp index 3d183dc403..3791ad7a20 100644 --- a/sound/decoders/mp3.cpp +++ b/sound/decoders/mp3.cpp @@ -338,6 +338,7 @@ int MP3InputStream::readBuffer(int16 *buffer, const int numSamples) { SeekableAudioStream *makeMP3Stream( Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) { + // TODO: Properly check whether creating the MP3 stream succeeded. return new MP3InputStream(stream, disposeAfterUse); } diff --git a/sound/decoders/vorbis.cpp b/sound/decoders/vorbis.cpp index 5899eaa1fd..5334240a90 100644 --- a/sound/decoders/vorbis.cpp +++ b/sound/decoders/vorbis.cpp @@ -244,7 +244,13 @@ bool VorbisInputStream::refill() { SeekableAudioStream *makeVorbisStream( Common::SeekableReadStream *stream, DisposeAfterUse::Flag disposeAfterUse) { - return new VorbisInputStream(stream, disposeAfterUse); + SeekableAudioStream *s = new VorbisInputStream(stream, disposeAfterUse); + if (s && s->endOfData()) { + delete s; + return 0; + } else { + return s; + } } } // End of namespace Audio |