From 1b24b2eca5d19c19a94807e8884c332fc610e8af Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Mon, 14 Jan 2019 22:56:57 +0100 Subject: [PATCH] Android/openslES: fix Pause/ResumeDevices when openslES is not used --- src/audio/openslES/SDL_openslES.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c index bd0a2874667f3..ceabf7a6899d5 100644 --- a/src/audio/openslES/SDL_openslES.c +++ b/src/audio/openslES/SDL_openslES.c @@ -602,23 +602,23 @@ AudioBootStrap openslES_bootstrap = { void openslES_ResumeDevices() { - SLresult result; - - /* set the player's state to 'playing' */ - result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); - if (SL_RESULT_SUCCESS != result) { - SDL_SetError("Play set state failed"); + if (bqPlayerPlay != NULL) { + /* set the player's state to 'playing' */ + SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING); + if (SL_RESULT_SUCCESS != result) { + SDL_SetError("openslES_ResumeDevices failed"); + } } } void openslES_PauseDevices() { - SLresult result; - - /* set the player's state to 'paused' */ - result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED); - if (SL_RESULT_SUCCESS != result) { - SDL_SetError("Playe set state failed"); + if (bqPlayerPlay != NULL) { + /* set the player's state to 'paused' */ + SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED); + if (SL_RESULT_SUCCESS != result) { + SDL_SetError("openslES_PauseDevices failed"); + } } }