소스 검색

Merge pull request #49556 from timothyqiu/joypad-button-range-check

Fix `InputEventJoypadButton::as_text` crash for invalid button index
Rémi Verschelde 4 년 전
부모
커밋
b536bac28e
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      core/input/input_event.cpp

+ 1 - 1
core/input/input_event.cpp

@@ -1023,7 +1023,7 @@ static const char *_joy_button_descriptions[JOY_BUTTON_SDL_MAX] = {
 String InputEventJoypadButton::as_text() const {
 	String text = "Joypad Button " + itos(button_index);
 
-	if (button_index < JOY_BUTTON_SDL_MAX) {
+	if (button_index >= 0 && button_index < JOY_BUTTON_SDL_MAX) {
 		text += vformat(" (%s)", _joy_button_descriptions[button_index]);
 	}