Fixed bug 4024 - GameController error "Unexpected controller element"
authorSylvain Becker <sylvain.becker@gmail.com>
Mon, 21 Jan 2019 23:41:43 +0100
changeset 1256905aff4771d9a
parent 12568 f9d4bc2af027
child 12570 bb39a14d510c
Fixed bug 4024 - GameController error "Unexpected controller element"

If mapping string is terminated with a comma, there is no more values to parse.
src/joystick/SDL_gamecontroller.c
     1.1 --- a/src/joystick/SDL_gamecontroller.c	Mon Jan 21 20:49:08 2019 +0100
     1.2 +++ b/src/joystick/SDL_gamecontroller.c	Mon Jan 21 23:41:43 2019 +0100
     1.3 @@ -676,8 +676,10 @@
     1.4          pchPos++;
     1.5      }
     1.6  
     1.7 -    SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton);
     1.8 -
     1.9 +    /* No more values if the string was terminated by a comma. Don't report an error. */
    1.10 +    if (szGameButton[0] != '\0' || szJoystickButton[0] != '\0') {
    1.11 +        SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton);
    1.12 +    }
    1.13  }
    1.14  
    1.15  /*