From 5dfc75633f21b5282422aa2db9d00cc3a766bc68 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Fri, 1 Jun 2007 18:08:42 +0000 Subject: Display a meaningful message when trying to start with an invalid Joystick ID. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 890 --- src/i_joystick.c | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- cgit v1.2.3