aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorMax Horn2003-08-05 00:31:00 +0000
committerMax Horn2003-08-05 00:31:00 +0000
commitb96e5501e669dc7e781a780ac810963d08131477 (patch)
tree823a19aaf812d4878ca9501838c890690e04e573 /sound
parente1ff91ea7d64a656767770a1c52d6d5eaebe398f (diff)
downloadscummvm-rg350-b96e5501e669dc7e781a780ac810963d08131477.tar.gz
scummvm-rg350-b96e5501e669dc7e781a780ac810963d08131477.tar.bz2
scummvm-rg350-b96e5501e669dc7e781a780ac810963d08131477.zip
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
Diffstat (limited to 'sound')
-rw-r--r--sound/audiostream.cpp4
1 files 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<is16Bit, isUnsigned>(_ptr);
@@ -80,7 +80,7 @@ public:
_ptr = _loopPtr;
_end = _loopEnd;
}
- } while (samples < numSamples && !eosIntern());
+ }
return samples;
}