diff --git a/Source/OpenTK/Input/KeyboardDevice.cs b/Source/OpenTK/Input/KeyboardDevice.cs index d21ca5a7..7150c874 100644 --- a/Source/OpenTK/Input/KeyboardDevice.cs +++ b/Source/OpenTK/Input/KeyboardDevice.cs @@ -201,6 +201,10 @@ namespace OpenTK.Input { if (keys[(int)key] != state || KeyRepeat) { + // limit scancode to 8bits, otherwise the assignment + // below will crash randomly + scancode &= 0xff; + keys[(int)key] = scancodes[scancode] = state; if (state && KeyDown != null)