A1rPun/MonoGame.InputManager

Exception when caling "FindNewGamepads()" - ArgumentOutOfRangeException

Phischermen opened this issue · 0 comments

System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index')

https://github.com/A1rPun/MonoGame.InputManager/blame/c325f08ff9554d361432ab58fed6503d0b496342/InputManager.cs#L466

This line is the culprit. Modifying the code to replace RemoveAt(player.GamePadIndex) with Remove(player.GamePadIndex) fixed the issue; it appears that piece of code is for culling gamepad indexes that are already connected, but RemoveAt can lead to culling the wrong index / causing an out of range exception.