AAudio: make sure stream is not null to prevent crash in RequestStop (see #3710)

This commit is contained in:
Sylvain 2021-04-28 21:04:47 +02:00
parent c93e3b3607
commit fcbf19b764
No known key found for this signature in database
GPG Key ID: 5F87E02E5BC0939E
1 changed files with 13 additions and 11 deletions

View File

@ -165,6 +165,7 @@ aaudio_CloseDevice(_THIS)
aaudio_result_t res; aaudio_result_t res;
LOGI(__func__); LOGI(__func__);
if (private->stream) {
res = ctx.AAudioStream_requestStop(private->stream); res = ctx.AAudioStream_requestStop(private->stream);
if (res != AAUDIO_OK) { if (res != AAUDIO_OK) {
LOGI("SDL Failed AAudioStream_requestStop %d", res); LOGI("SDL Failed AAudioStream_requestStop %d", res);
@ -178,6 +179,7 @@ aaudio_CloseDevice(_THIS)
SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res)); SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res));
return; return;
} }
}
if (this->iscapture) { if (this->iscapture) {
SDL_assert(captureDevice == this); SDL_assert(captureDevice == this);