aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sound/mixer.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/mixer.cpp b/sound/mixer.cpp
index 4d04132822..83e48799db 100644
--- a/sound/mixer.cpp
+++ b/sound/mixer.cpp
@@ -933,6 +933,7 @@ void ChannelMP3CDMusic::mix(int16 *data, uint len) {
memset(_ptr, 0, _bufferSize);
_size = _file->read(_ptr, _bufferSize);
if (_size <= 0) {
+ debug(1, "Failed to read MP3 data during channel initialisation !");
destroy();
return;
}
@@ -1006,6 +1007,9 @@ void ChannelMP3CDMusic::mix(int16 *data, uint len) {
memcpy(_ptr, _stream.next_frame, not_decoded);
_size = _file->read(_ptr + not_decoded, _bufferSize - not_decoded);
}
+ if (_size <= 0) {
+ return;
+ }
_stream.error = (enum mad_error)0;
// Restream
mad_stream_buffer(&_stream, _ptr, _size + not_decoded);