commit 6aad2f80343bbc527b7f652fc9c1752a34442afd
Author: Simon Howard <fraggle@soulsphere.org>
AuthorDate: Sun Jan 3 15:27:48 2016 +0100
Commit: Simon Howard <fraggle@soulsphere.org>
CommitDate: Sun Jan 3 15:27:48 2016 +0100
joystick: Don't initialize if joystick_index < 0.
We only initialize the joystick subsystem if usejoystick is true, but
joystick_index must also be valid in order to use a joystick, and a
negative value indicates no joystick is set.
---
src/i_joystick.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/i_joystick.c b/src/i_joystick.c
index eba7f21a..76ef3b78 100644
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -107,7 +107,7 @@ static boolean IsValidAxis(int axis)
void I_InitJoystick(void)
{
- if (!usejoystick)
+ if (!usejoystick || joystick_index < 0)
{
return;
}
@@ -117,7 +117,7 @@ void I_InitJoystick(void)
return;
}
- if (joystick_index < 0 || joystick_index >= SDL_NumJoysticks())
+ if (joystick_index >= SDL_NumJoysticks())
{
printf("I_InitJoystick: Invalid joystick ID: %i\n", joystick_index);
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);