From 33479316c70c470653c2fc8ab61bb25fd5ef6af7 Mon Sep 17 00:00:00 2001 From: Gabriel Jacobo Date: Mon, 27 Jan 2014 17:59:19 -0300 Subject: [PATCH] [Android] Fixes Bug 2370, don't send accelerometer changes when Android_JNI_GetAccelerometerValues return SDL_FALSE (thanks to Jairo Luiz) --- src/joystick/android/SDL_sysjoystick.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/joystick/android/SDL_sysjoystick.c b/src/joystick/android/SDL_sysjoystick.c index 2065145cd..33aa5c35e 100644 --- a/src/joystick/android/SDL_sysjoystick.c +++ b/src/joystick/android/SDL_sysjoystick.c @@ -497,10 +497,11 @@ SDL_SYS_JoystickUpdate(SDL_Joystick * joystick) while (item) { if (item->is_accelerometer) { if (item->joystick) { - Android_JNI_GetAccelerometerValues(values); - for ( i = 0; i < 3; i++ ) { - value = (Sint16)(values[i] * 32767.0f); - SDL_PrivateJoystickAxis(item->joystick, i, value); + if (Android_JNI_GetAccelerometerValues(values)) { + for ( i = 0; i < 3; i++ ) { + value = (Sint16)(values[i] * 32767.0f); + SDL_PrivateJoystickAxis(item->joystick, i, value); + } } } break;