You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-12 13:20:55 +00:00
Fix InputEventJoypadButton::as_text crash for invalid button index
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user