aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Input.SDL2/SDL2GamepadDriver.cs')
-rw-r--r--Ryujinx.Input.SDL2/SDL2GamepadDriver.cs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs b/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs
index b20a76b8..d4086a10 100644
--- a/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs
+++ b/Ryujinx.Input.SDL2/SDL2GamepadDriver.cs
@@ -27,7 +27,9 @@ namespace Ryujinx.Input.SDL2
SDL2Driver.Instance.OnJoystickDisconnected += HandleJoyStickDisconnected;
// Add already connected gamepads
- for (int joystickIndex = 0; joystickIndex < SDL_NumJoysticks(); joystickIndex++)
+ int numJoysticks = SDL_NumJoysticks();
+
+ for (int joystickIndex = 0; joystickIndex < numJoysticks; joystickIndex++)
{
HandleJoyStickConnected(joystickIndex, SDL_JoystickGetDeviceInstanceID(joystickIndex));
}