From c9aec268fa7f892e183219683160599a4a2b86db Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Fri, 3 Mar 2023 16:15:28 -0800
Subject: [PATCH] SDL_GetJoystickIDForPlayerIndex() should return 0 for invalid
ID (thanks @AntTheAlchemist!)
---
src/joystick/SDL_joystick.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/joystick/SDL_joystick.c b/src/joystick/SDL_joystick.c
index 2fbaaf0623f9..63a8842bb50e 100644
--- a/src/joystick/SDL_joystick.c
+++ b/src/joystick/SDL_joystick.c
@@ -232,7 +232,7 @@ static SDL_JoystickID SDL_GetJoystickIDForPlayerIndex(int player_index)
SDL_AssertJoysticksLocked();
if (player_index < 0 || player_index >= SDL_joystick_player_count) {
- return -1;
+ return 0;
}
return SDL_joystick_players[player_index];
}