From 77ca0f273c6ab6747a52e82ea2ed76c939b37402 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Thu, 27 Jul 2017 22:55:18 -0700 Subject: [PATCH] Fixed crash if the WASAPI audio device couldn't be recovered --- src/audio/wasapi/SDL_wasapi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/audio/wasapi/SDL_wasapi.c b/src/audio/wasapi/SDL_wasapi.c index 6af22ceb0..0a3bf92d8 100644 --- a/src/audio/wasapi/SDL_wasapi.c +++ b/src/audio/wasapi/SDL_wasapi.c @@ -372,7 +372,8 @@ WASAPI_GetPendingBytes(_THIS) UINT32 frames = 0; /* it's okay to fail here; we'll deal with failures in the audio thread. */ - if (FAILED(IAudioClient_GetCurrentPadding(this->hidden->client, &frames))) { + /* FIXME: need a lock around checking this->hidden->client */ + if (!this->hidden->client || FAILED(IAudioClient_GetCurrentPadding(this->hidden->client, &frames))) { return 0; /* oh well. */ }