Skip to content

Commit

Permalink
Don't crash when calling alSourcei(src, AL_BUFFER, 0);
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Mar 28, 2018
1 parent d4b9eac commit 245cef2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mojoal.c
Expand Up @@ -2189,7 +2189,7 @@ void alSourceiv(ALuint name, ALenum param, const ALint *values)
SDL_AudioStream *stream = NULL;
/* We only use the stream for resampling, not for channel conversion. */
FIXME("keep the existing stream if formats match?");
if (ctx->device->frequency != buffer->frequency) {
if (buffer && (ctx->device->frequency != buffer->frequency)) {
stream = SDL_NewAudioStream(AUDIO_F32SYS, buffer->channels, buffer->frequency, AUDIO_F32SYS, buffer->channels, ctx->device->frequency);
if (!stream) {
set_al_error(ctx, AL_OUT_OF_MEMORY);
Expand Down

0 comments on commit 245cef2

Please sign in to comment.