From b96e5501e669dc7e781a780ac810963d08131477 Mon Sep 17 00:00:00 2001 From: Max Horn Date: Tue, 5 Aug 2003 00:31:00 +0000 Subject: catch one potential problem, namely if eos is already reached when readBuffer is called ('This should never happen anyway', famous last words) svn-id: r9472 --- sound/audiostream.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/audiostream.cpp b/sound/audiostream.cpp index e636e96cb2..2c92fc7916 100644 --- a/sound/audiostream.cpp +++ b/sound/audiostream.cpp @@ -70,7 +70,7 @@ public: } int readBuffer(int16 *buffer, int numSamples) { int samples = 0; - do { + while (samples < numSamples && !eosIntern()) { const int len = MIN(numSamples, (_end - _ptr) / (is16Bit ? 2 : 1)); for (; samples < len; samples++) { *buffer++ = readSample(_ptr); @@ -80,7 +80,7 @@ public: _ptr = _loopPtr; _end = _loopEnd; } - } while (samples < numSamples && !eosIntern()); + } return samples; } -- cgit v1.2.3