Android: fix joystick allocation that can be never used

This commit is contained in:
Sylvain Becker 2020-10-05 14:09:31 +02:00
parent 2e38c94950
commit a70bb58d4b

View File

@ -180,9 +180,9 @@ class SDLJoystickHandler_API16 extends SDLJoystickHandler {
for(int i=0; i < deviceIds.length; ++i) { for(int i=0; i < deviceIds.length; ++i) {
SDLJoystick joystick = getJoystick(deviceIds[i]); SDLJoystick joystick = getJoystick(deviceIds[i]);
if (joystick == null) { if (joystick == null) {
joystick = new SDLJoystick();
InputDevice joystickDevice = InputDevice.getDevice(deviceIds[i]); InputDevice joystickDevice = InputDevice.getDevice(deviceIds[i]);
if (SDLControllerManager.isDeviceSDLJoystick(deviceIds[i])) { if (SDLControllerManager.isDeviceSDLJoystick(deviceIds[i])) {
joystick = new SDLJoystick();
joystick.device_id = deviceIds[i]; joystick.device_id = deviceIds[i];
joystick.name = joystickDevice.getName(); joystick.name = joystickDevice.getName();
joystick.desc = getJoystickDescriptor(joystickDevice); joystick.desc = getJoystickDescriptor(joystickDevice);