diff options
author | Chris Robinson <[email protected]> | 2011-09-18 20:27:34 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2011-09-18 20:27:34 -0700 |
commit | cc3dd648ace1f1276e909dcb07adf782a39f1cf3 (patch) | |
tree | b23d5bb282553f028d96795320d2f5b5b10de5fe /Alc/ALc.c | |
parent | 98b2fa6cb523cab6702bfeee36e089711012b9d8 (diff) |
Check the number of available samples before calling the capture method
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r-- | Alc/ALc.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1704,8 +1704,10 @@ ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCenum err = ALC_INVALID_DEVICE; if((device=VerifyDevice(device)) != NULL && device->IsCaptureDevice) { + err = ALC_INVALID_VALUE; LockDevice(device); - err = ALCdevice_CaptureSamples(device, buffer, samples); + if(samples >= 0 && ALCdevice_AvailableSamples(device) >= (ALCuint)samples) + err = ALCdevice_CaptureSamples(device, buffer, samples); UnlockDevice(device); } if(err != ALC_NO_ERROR) |