diff options
Diffstat (limited to 'OpenAL32')
-rw-r--r-- | OpenAL32/alBuffer.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 768cc213..712acc94 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -844,9 +844,12 @@ AL_API ALvoid AL_APIENTRY alGetBufferf(ALuint buffer, ALenum eParam, ALfloat *pf { case AL_SEC_LENGTH: ReadLock(&pBuffer->lock); - *pflValue = (pBuffer->size / - FrameSizeFromFmt(pBuffer->FmtChannels, pBuffer->FmtType)) / - (ALfloat)pBuffer->Frequency; + if(pBuffer->size != 0) + *pflValue = (pBuffer->size / + FrameSizeFromFmt(pBuffer->FmtChannels, pBuffer->FmtType)) / + (ALfloat)pBuffer->Frequency; + else + *pflValue = 0.0f; ReadUnlock(&pBuffer->lock); break; @@ -965,8 +968,11 @@ AL_API ALvoid AL_APIENTRY alGetBufferi(ALuint buffer, ALenum eParam, ALint *plVa case AL_SAMPLE_LENGTH: ReadLock(&pBuffer->lock); - *plValue = pBuffer->size / - FrameSizeFromFmt(pBuffer->FmtChannels, pBuffer->FmtType); + if(pBuffer->size != 0) + *plValue = pBuffer->size / + FrameSizeFromFmt(pBuffer->FmtChannels, pBuffer->FmtType); + else + *plValue = 0; ReadUnlock(&pBuffer->lock); break; |