update from PR feedback

This commit is contained in:
CrackedPixel 2026-03-04 01:31:40 -06:00
parent 406ad3aedc
commit 1c1b9b201e

View File

@ -2178,13 +2178,8 @@ static void CursorEnterCallback(GLFWwindow *window, int enter)
// GLFW3: Joystick connected/disconnected callback // GLFW3: Joystick connected/disconnected callback
static void JoystickCallback(int jid, int event) static void JoystickCallback(int jid, int event)
{ {
if (jid >= MAX_GAMEPADS) if (jid < MAX_GAMEPADS)
{ {
// WARNING: If jid is higher than maximum supported joysticks, just return. This
// prevents an out-of-bounds crash on linux when connecting a gamepad to a running app
return;
}
if (event == GLFW_CONNECTED) if (event == GLFW_CONNECTED)
{ {
// WARNING: If glfwGetJoystickName() is longer than MAX_GAMEPAD_NAME_LENGTH, // WARNING: If glfwGetJoystickName() is longer than MAX_GAMEPAD_NAME_LENGTH,
@ -2197,6 +2192,7 @@ static void JoystickCallback(int jid, int event)
memset(CORE.Input.Gamepad.name[jid], 0, MAX_GAMEPAD_NAME_LENGTH); memset(CORE.Input.Gamepad.name[jid], 0, MAX_GAMEPAD_NAME_LENGTH);
} }
} }
}
#ifdef _WIN32 #ifdef _WIN32
# define WIN32_CLIPBOARD_IMPLEMENTATION # define WIN32_CLIPBOARD_IMPLEMENTATION