1
0
forked from Clones/Controlify

🐛 Fix crash on shutdown when not using SDL natives with joysticks

This commit is contained in:
isXander
2023-07-02 19:49:50 +01:00
parent aab2ab5973
commit 8d30a2fc45

View File

@ -19,7 +19,7 @@ public class SingleJoystickController extends AbstractController<JoystickState,
private JoystickState state = JoystickState.EMPTY, prevState = JoystickState.EMPTY; private JoystickState state = JoystickState.EMPTY, prevState = JoystickState.EMPTY;
private final JoystickMapping mapping; private final JoystickMapping mapping;
private long ptrJoystick; private final long ptrJoystick;
private RumbleManager rumbleManager; private RumbleManager rumbleManager;
private boolean rumbleSupported; private boolean rumbleSupported;
@ -122,7 +122,8 @@ public class SingleJoystickController extends AbstractController<JoystickState,
@Override @Override
public void close() { public void close() {
SDL.SDL_JoystickClose(ptrJoystick); if (ptrJoystick != 0)
SDL.SDL_JoystickClose(ptrJoystick);
this.rumbleSupported = false; this.rumbleSupported = false;
this.rumbleManager = null; this.rumbleManager = null;
} }