소스 검색

Fixed bug 4024 - GameController error "Unexpected controller element"

If mapping string is terminated with a comma, there is no more values to parse.
Sylvain Becker 6 년 전
부모
커밋
82b2c849f0
1개의 변경된 파일4개의 추가작업 그리고 2개의 파일을 삭제
  1. 4 2
      src/joystick/SDL_gamecontroller.c

+ 4 - 2
src/joystick/SDL_gamecontroller.c

@@ -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);
+    }
 }
 
 /*