Android: fix crash when AAUDIO isn't used (bug #7620)

main
Sylvain 2023-04-18 21:32:15 +02:00 committed by Sylvain Becker
parent bad4f4e5ac
commit 9d18b4b5ed
1 changed files with 18 additions and 0 deletions

View File

@ -321,6 +321,12 @@ AudioBootStrap aaudio_bootstrap = {
void aaudio_PauseDevices(void) void aaudio_PauseDevices(void)
{ {
int i; int i;
/* AAUDIO driver is not used */
if (ctx.handle == NULL) {
return;
}
for (i = 0; i < get_max_num_audio_dev(); i++) { for (i = 0; i < get_max_num_audio_dev(); i++) {
SDL_AudioDevice *this = get_audio_dev(i); SDL_AudioDevice *this = get_audio_dev(i);
SDL_AudioDevice *audioDevice = NULL; SDL_AudioDevice *audioDevice = NULL;
@ -386,6 +392,12 @@ void aaudio_PauseDevices(void)
void aaudio_ResumeDevices(void) void aaudio_ResumeDevices(void)
{ {
int i; int i;
/* AAUDIO driver is not used */
if (ctx.handle == NULL) {
return;
}
for (i = 0; i < get_max_num_audio_dev(); i++) { for (i = 0; i < get_max_num_audio_dev(); i++) {
SDL_AudioDevice *this = get_audio_dev(i); SDL_AudioDevice *this = get_audio_dev(i);
SDL_AudioDevice *audioDevice = NULL; SDL_AudioDevice *audioDevice = NULL;
@ -447,6 +459,12 @@ void aaudio_ResumeDevices(void)
SDL_bool aaudio_DetectBrokenPlayState(void) SDL_bool aaudio_DetectBrokenPlayState(void)
{ {
int i; int i;
/* AAUDIO driver is not used */
if (ctx.handle == NULL) {
return SDL_FALSE;
}
for (i = 0; i < get_max_num_audio_dev(); i++) { for (i = 0; i < get_max_num_audio_dev(); i++) {
SDL_AudioDevice *this = get_audio_dev(i); SDL_AudioDevice *this = get_audio_dev(i);
SDL_AudioDevice *audioDevice = NULL; SDL_AudioDevice *audioDevice = NULL;