Parcourir la source

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

Bart van Strien il y a 14 ans
Parent
commit
bf9ad64559
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      src/modules/joystick/sdl/Joystick.cpp

+ 1 - 1
src/modules/joystick/sdl/Joystick.cpp

@@ -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;
 		}