Prevent negative joystick button indices from being used by isDown. (as mentioned in issue #121)

This commit is contained in:
Bart van Strien
2011-04-23 19:12:52 +02:00
parent cdf85280b6
commit bf9ad64559
+1 -1
View File
@@ -198,7 +198,7 @@ namespace sdl
for (int button = *buttonlist; button != -1; button = *(++buttonlist))
{
if (button < num && SDL_JoystickGetButton(joysticks[index], button) == 1)
if (button >= 0 && button < num && SDL_JoystickGetButton(joysticks[index], button) == 1)
return true;
}