From a70bb58d4b97309a321a088f6540ebc6ccc278d0 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Mon, 5 Oct 2020 14:09:31 +0200 Subject: [PATCH] Android: fix joystick allocation that can be never used --- .../app/src/main/java/org/libsdl/app/SDLControllerManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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);