try 1: Fix IndexOutOfBounds in SDL2GamepadDriver.cs

This commit is contained in:
Evan Husted 2024-11-17 00:57:56 -06:00
parent 6de3afc43d
commit 52f42d450f

View file

@ -115,7 +115,10 @@ namespace Ryujinx.Input.SDL2
{ {
lock (_lock) lock (_lock)
{ {
_gamepadsIds.Insert(joystickDeviceId, id); if (joystickDeviceId <= _gamepadsIds.FindLastIndex(_ => true))
_gamepadsIds.Insert(joystickDeviceId, id);
else
_gamepadsIds.Add(id);
} }
OnGamepadConnected?.Invoke(id); OnGamepadConnected?.Invoke(id);