From 7e0b4d1c69b033dc47859c50431414111ae3978f Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Mon, 26 Nov 2012 22:09:34 -0800 Subject: [PATCH] Return an error if the joystick index isn't 0 on Android --- src/joystick/android/SDL_sysjoystick.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c index 88d0c2eb8..30a423da1 100644 --- a/src/joystick/android/SDL_sysjoystick.c +++ b/src/joystick/android/SDL_sysjoystick.c @@ -64,13 +64,18 @@ SDL_SYS_JoystickNameForIndex(int index) It returns 0, or -1 if there is an error. */ int -SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int index) +SDL_SYS_JoystickOpen(SDL_Joystick * joystick, int device_index) { - joystick->nbuttons = 0; - joystick->nhats = 0; - joystick->nballs = 0; - joystick->naxes = 3; - return 0; + if (device_index == 0) { + joystick->nbuttons = 0; + joystick->nhats = 0; + joystick->nballs = 0; + joystick->naxes = 3; + return 0; + } else { + SDL_SetError("No joystick available with that index"); + return (-1); + } }