diff options
author | Chris Robinson <[email protected]> | 2018-01-22 00:23:19 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-01-22 00:31:27 -0800 |
commit | f1f7fba3b97c9523a6bd9a12d0edf799f457b602 (patch) | |
tree | 177a0f01f4dee4090d529bc18c9c5f9bf9954e6d | |
parent | ca07e210a7790272718305529a3e2e5ee0ea6df2 (diff) |
Don't convert/copy samples with a NULL dest buffer
Only happens with a 0 size, so there's nothing to copy or convert anyway.
-rw-r--r-- | OpenAL32/alBuffer.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/OpenAL32/alBuffer.c b/OpenAL32/alBuffer.c index 9acbb148..2189f015 100644 --- a/OpenAL32/alBuffer.c +++ b/OpenAL32/alBuffer.c @@ -939,7 +939,7 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALsizei frames, enum UserFm ALBuf->OriginalSize = frames / align * byte_align; ALBuf->OriginalAlign = align; assert(DstType == FmtShort); - if(data != NULL) + if(data != NULL && ALBuf->data != NULL) Convert_ALshort_ALima4(ALBuf->data, data, NumChannels, frames, align); } else if(SrcType == UserFmtMSADPCM) @@ -948,18 +948,16 @@ static ALenum LoadData(ALbuffer *ALBuf, ALuint freq, ALsizei frames, enum UserFm ALBuf->OriginalSize = frames / align * byte_align; ALBuf->OriginalAlign = align; assert(DstType == FmtShort); - if(data != NULL) + if(data != NULL && ALBuf->data != NULL) Convert_ALshort_ALmsadpcm(ALBuf->data, data, NumChannels, frames, align); } else { ALBuf->OriginalSize = frames * FrameSize; ALBuf->OriginalAlign = 1; - if(data != NULL) - { - assert((long)SrcType == (long)DstType); + assert((long)SrcType == (long)DstType); + if(data != NULL && ALBuf->data != NULL) memcpy(ALBuf->data, data, frames*FrameSize); - } } ALBuf->Frequency = freq; |