From 121540f428b2a93e4879e8b8e61b4af480dc82df Mon Sep 17 00:00:00 2001 From: Alug Date: Sat, 10 May 2025 21:37:16 +0200 Subject: [PATCH] dont check for how many controllers just attempt to reset "all" JoyInfo->dev will be null The crash before was most likely due to an oob read --- src/g_input.c | 5 +---- src/sdl/i_system.c | 2 ++ 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/g_input.c b/src/g_input.c index 85de4c6ec..963663504 100644 --- a/src/g_input.c +++ b/src/g_input.c @@ -963,11 +963,8 @@ static void G_ResetPlayerDeviceRumble(INT32 playernum) void G_ResetAllDeviceRumbles(void) { int i; - int devices; - devices = I_NumJoys(); - - for (i = 0; i < devices; i++) + for (i = 0; i < MAXSPLITSCREENPLAYERS; i++) { I_GamepadRumble(i, 0, 0, 0); } diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index b622c4c45..549fdf7bd 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -1485,6 +1485,7 @@ void I_GamepadRumble(INT32 playernum, UINT16 low_strength, UINT16 high_strength, (void)duration; #else SDL_GameController *controller = JoyInfo[playernum].dev; + if (controller == NULL) { return; @@ -1503,6 +1504,7 @@ void I_SetGamepadIndicatorColor(INT32 playernum, UINT8 red, UINT8 green, UINT8 b (void)blue; #else SDL_GameController *controller = JoyInfo[playernum].dev; + if (controller == NULL) { return;