Fixed: Possible crash when queued buffers are already empty

--HG--
branch : develop
This commit is contained in:
Nimetu 2019-02-18 22:22:25 +02:00
parent 1e6027c970
commit 1635330a14

View file

@ -194,7 +194,7 @@ uint CSourceAL::countStreamingBuffers() const
// a bit ugly here, but makes a much easier/simpler implementation on both drivers // a bit ugly here, but makes a much easier/simpler implementation on both drivers
ALint buffersProcessed; ALint buffersProcessed;
alGetSourcei(_Source, AL_BUFFERS_PROCESSED, &buffersProcessed); alGetSourcei(_Source, AL_BUFFERS_PROCESSED, &buffersProcessed);
while (buffersProcessed) while (buffersProcessed && !_QueuedBuffers.empty())
{ {
ALuint bufferName = _QueuedBuffers.front()->bufferName(); ALuint bufferName = _QueuedBuffers.front()->bufferName();
alSourceUnqueueBuffers(_Source, 1, &bufferName); alSourceUnqueueBuffers(_Source, 1, &bufferName);