summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2007-06-01 18:08:42 +0000
committerSimon Howard2007-06-01 18:08:42 +0000
commit5dfc75633f21b5282422aa2db9d00cc3a766bc68 (patch)
treed3f14e0491be745a0149d7a0d6594e2f533d8b3d
parent200a86cf8378233fbb9e3687620ea9e577c3d773 (diff)
downloadchocolate-doom-5dfc75633f21b5282422aa2db9d00cc3a766bc68.tar.gz
chocolate-doom-5dfc75633f21b5282422aa2db9d00cc3a766bc68.tar.bz2
chocolate-doom-5dfc75633f21b5282422aa2db9d00cc3a766bc68.zip
Display a meaningful message when trying to start with an invalid
Joystick ID. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 890
-rw-r--r--src/i_joystick.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/i_joystick.c b/src/i_joystick.c
index 4d73a3af..0e0f7590 100644
--- a/src/i_joystick.c
+++ b/src/i_joystick.c
@@ -75,6 +75,13 @@ void I_InitJoystick(void)
return;
}
+ if (joystick_index < 0 || joystick_index >= SDL_NumJoysticks())
+ {
+ printf("I_InitJoystick: Invalid joystick ID: %i\n", joystick_index);
+ SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
+ return;
+ }
+
// Open the joystick
joystick = SDL_JoystickOpen(joystick_index);