Skip to content

Commit

Permalink
Fixed bug 4024 - GameController error "Unexpected controller element"
Browse files Browse the repository at this point in the history
If mapping string is terminated with a comma, there is no more values to parse.
  • Loading branch information
1bsyl committed Jan 21, 2019
1 parent adabfdc commit 82b2c84
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/joystick/SDL_gamecontroller.c
Expand Up @@ -676,8 +676,10 @@ SDL_PrivateGameControllerParseControllerConfigString(SDL_GameController *gamecon
pchPos++;
}

SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton);

/* No more values if the string was terminated by a comma. Don't report an error. */
if (szGameButton[0] != '\0' || szJoystickButton[0] != '\0') {
SDL_PrivateGameControllerParseElement(gamecontroller, szGameButton, szJoystickButton);
}
}

/*
Expand Down

0 comments on commit 82b2c84

Please sign in to comment.