Explorar o código

Fixed crash if the WASAPI audio device couldn't be recovered

Sam Lantinga %!s(int64=8) %!d(string=hai) anos
pai
achega
77ca0f273c
Modificáronse 1 ficheiros con 2 adicións e 1 borrados
  1. 2 1
      src/audio/wasapi/SDL_wasapi.c

+ 2 - 1
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. */
     }