Android/openslES: fix Pause/ResumeDevices when openslES is not used
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
diff --git a/src/audio/openslES/SDL_openslES.c b/src/audio/openslES/SDL_openslES.c
index bd0a287..ceabf7a 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");
+ }
}
}