Android/openslES: fix Pause/ResumeDevices when openslES is not used
authorSylvain Becker <sylvain.becker@gmail.com>
Mon, 14 Jan 2019 22:56:57 +0100
changeset 12545599ebb123f0a
parent 12544 ea4097dfa68d
child 12546 aab006efb893
Android/openslES: fix Pause/ResumeDevices when openslES is not used
src/audio/openslES/SDL_openslES.c
     1.1 --- a/src/audio/openslES/SDL_openslES.c	Mon Jan 14 21:34:12 2019 +0100
     1.2 +++ b/src/audio/openslES/SDL_openslES.c	Mon Jan 14 22:56:57 2019 +0100
     1.3 @@ -602,23 +602,23 @@
     1.4  
     1.5  void openslES_ResumeDevices()
     1.6  {
     1.7 -    SLresult result;
     1.8 -
     1.9 -    /* set the player's state to 'playing' */
    1.10 -    result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
    1.11 -    if (SL_RESULT_SUCCESS != result) {
    1.12 -        SDL_SetError("Play set state failed");
    1.13 +    if (bqPlayerPlay != NULL) {
    1.14 +        /* set the player's state to 'playing' */
    1.15 +        SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PLAYING);
    1.16 +        if (SL_RESULT_SUCCESS != result) {
    1.17 +            SDL_SetError("openslES_ResumeDevices failed");
    1.18 +        }
    1.19      }
    1.20  }
    1.21  
    1.22  void openslES_PauseDevices()
    1.23  {
    1.24 -    SLresult result;
    1.25 -
    1.26 -    /* set the player's state to 'paused' */
    1.27 -    result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED);
    1.28 -    if (SL_RESULT_SUCCESS != result) {
    1.29 -        SDL_SetError("Playe set state failed");
    1.30 +    if (bqPlayerPlay != NULL) {
    1.31 +        /* set the player's state to 'paused' */
    1.32 +        SLresult result = (*bqPlayerPlay)->SetPlayState(bqPlayerPlay, SL_PLAYSTATE_PAUSED);
    1.33 +        if (SL_RESULT_SUCCESS != result) {
    1.34 +            SDL_SetError("openslES_PauseDevices failed");
    1.35 +        }
    1.36      }
    1.37  }
    1.38