From 9e7a7179747e371d7ac459df0f4ffa7e8b0c98f3 Mon Sep 17 00:00:00 2001 From: SRSaunders <82544213+SRSaunders@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:06:53 -0500 Subject: [PATCH] A few more OpenAL defensive checks in idSoundVoice_OpenAL::SubmitBuffer() --- neo/sound/OpenAL/AL_SoundVoice.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/neo/sound/OpenAL/AL_SoundVoice.cpp b/neo/sound/OpenAL/AL_SoundVoice.cpp index 39ff1186..0e5eec7c 100644 --- a/neo/sound/OpenAL/AL_SoundVoice.cpp +++ b/neo/sound/OpenAL/AL_SoundVoice.cpp @@ -379,7 +379,10 @@ int idSoundVoice_OpenAL::SubmitBuffer( idSoundSample_OpenAL* sample, int bufferN if( sample->openalBuffer != 0 ) { - alSourcei( openalSource, AL_BUFFER, sample->openalBuffer ); + if( alIsBuffer( sample->openalBuffer ) ) + { + alSourcei( openalSource, AL_BUFFER, sample->openalBuffer ); + } alSourcei( openalSource, AL_LOOPING, ( sample == loopingSample && loopingSample != NULL ? AL_TRUE : AL_FALSE ) ); return sample->totalBufferSize; @@ -443,14 +446,20 @@ int idSoundVoice_OpenAL::SubmitBuffer( idSoundSample_OpenAL* sample, int bufferN - alBufferData( openalStreamingBuffer[j], format, sample->buffers[bufferNumber].buffer, sample->buffers[bufferNumber].bufferSize, rate ); + if( openalStreamingBuffer[j] ) + { + alBufferData( openalStreamingBuffer[j], format, sample->buffers[bufferNumber].buffer, sample->buffers[bufferNumber].bufferSize, rate ); + } //openalStreamingOffset += MIXBUFFER_SAMPLES; } if( finishedbuffers > 0 ) { //alSourceQueueBuffers( openalSource, finishedbuffers, &buffers[0] ); - alSourceQueueBuffers( openalSource, 1, &openalStreamingBuffer[0] ); + if( openalStreamingBuffer[0] ) + { + alSourceQueueBuffers( openalSource, 1, &openalStreamingBuffer[0] ); + } if( bufferNumber == 0 ) {