aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/ALc.c
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2011-09-18 20:27:34 -0700
committerChris Robinson <[email protected]>2011-09-18 20:27:34 -0700
commitcc3dd648ace1f1276e909dcb07adf782a39f1cf3 (patch)
treeb23d5bb282553f028d96795320d2f5b5b10de5fe /Alc/ALc.c
parent98b2fa6cb523cab6702bfeee36e089711012b9d8 (diff)
Check the number of available samples before calling the capture method
Diffstat (limited to 'Alc/ALc.c')
-rw-r--r--Alc/ALc.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Alc/ALc.c b/Alc/ALc.c
index fa1ad2a7..0076921e 100644
--- a/Alc/ALc.c
+++ b/Alc/ALc.c
@@ -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)