diff --git a/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java b/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java index a81e97bee..d6db06571 100644 --- a/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java +++ b/android-project/app/src/main/java/org/libsdl/app/SDLControllerManager.java @@ -180,9 +180,9 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler { for(int i=0; i < deviceIds.length; ++i) { SDLJoystick joystick = getJoystick(deviceIds[i]); if (joystick == null) { - joystick = new SDLJoystick(); InputDevice joystickDevice = InputDevice.getDevice(deviceIds[i]); if (SDLControllerManager.isDeviceSDLJoystick(deviceIds[i])) { + joystick = new SDLJoystick(); joystick.device_id = deviceIds[i]; joystick.name = joystickDevice.getName(); joystick.desc = getJoystickDescriptor(joystickDevice);