From 24ae12f58ee42440d15a9d44a0e4c9607758de68 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 12 Mar 2019 09:56:02 -0700 Subject: Check a value where its used --- Alc/mixvoice.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'Alc') diff --git a/Alc/mixvoice.cpp b/Alc/mixvoice.cpp index 9f32db0e..3823963b 100644 --- a/Alc/mixvoice.cpp +++ b/Alc/mixvoice.cpp @@ -335,6 +335,8 @@ ALsizei LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&Bu ); return CompLen; }; + /* It's impossible to have a buffer list item with no entries. */ + ASSUME(BufferListItem->num_buffers > 0); auto buffers_end = BufferListItem->buffers + BufferListItem->num_buffers; FilledAmt += std::accumulate(BufferListItem->buffers, buffers_end, ALsizei{0}, load_buffer); @@ -359,6 +361,7 @@ ALsizei LoadBufferStatic(ALbufferlistitem *BufferListItem, ALbufferlistitem *&Bu ); return CompLen; }; + ASSUME(BufferListItem->num_buffers > 0); auto buffers_end = BufferListItem->buffers + BufferListItem->num_buffers; FilledAmt += std::accumulate(BufferListItem->buffers, buffers_end, ALsizei{0}, load_buffer); @@ -423,6 +426,7 @@ ALsizei LoadBufferQueue(ALbufferlistitem *BufferListItem, ALbufferlistitem *Buff buffer->mFmtType, DataSize); return CompLen; }; + ASSUME(BufferListItem->num_buffers > 0); auto buffers_end = BufferListItem->buffers + BufferListItem->num_buffers; FilledAmt += std::accumulate(BufferListItem->buffers, buffers_end, ALsizei{0}, load_buffer); @@ -545,9 +549,6 @@ void MixVoice(ALvoice *voice, ALvoice::State vstate, const ALuint SourceID, ALCc DstBufferSize &= ~3; } - /* It's impossible to have a buffer list item with no entries. */ - assert(!BufferListItem || BufferListItem->num_buffers > 0); - for(ALsizei chan{0};chan < NumChannels;chan++) { auto &SrcData = Device->SourceData; -- cgit v1.2.3