mirror of https://github.com/encounter/SDL.git
AAudio: make sure stream is not null to prevent crash in RequestStop (see #3710)
This commit is contained in:
parent
c93e3b3607
commit
fcbf19b764
|
@ -165,18 +165,20 @@ aaudio_CloseDevice(_THIS)
|
||||||
aaudio_result_t res;
|
aaudio_result_t res;
|
||||||
LOGI(__func__);
|
LOGI(__func__);
|
||||||
|
|
||||||
res = ctx.AAudioStream_requestStop(private->stream);
|
if (private->stream) {
|
||||||
if (res != AAUDIO_OK) {
|
res = ctx.AAudioStream_requestStop(private->stream);
|
||||||
LOGI("SDL Failed AAudioStream_requestStop %d", res);
|
if (res != AAUDIO_OK) {
|
||||||
SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res));
|
LOGI("SDL Failed AAudioStream_requestStop %d", res);
|
||||||
return;
|
SDL_SetError("%s : %s", __func__, ctx.AAudio_convertResultToText(res));
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
res = ctx.AAudioStream_close(private->stream);
|
res = ctx.AAudioStream_close(private->stream);
|
||||||
if (res != AAUDIO_OK) {
|
if (res != AAUDIO_OK) {
|
||||||
LOGI("SDL Failed AAudioStreamBuilder_delete %d", res);
|
LOGI("SDL Failed AAudioStreamBuilder_delete %d", res);
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue