1
0
forked from Clones/Controlify

🐛 Fix crash with joysticks

This commit is contained in:
isXander
2023-06-04 14:01:20 +01:00
parent 6f5eb5d061
commit 6f75006605

View File

@ -81,7 +81,7 @@ public class JoystickState implements ControllerState {
} }
Optional<ByteBuffer> buttonBuffer = Optional.ofNullable(GLFW.glfwGetJoystickButtons(joystickId)); Optional<ByteBuffer> buttonBuffer = Optional.ofNullable(GLFW.glfwGetJoystickButtons(joystickId));
boolean[] inButtons = new boolean[axesBuffer.map(FloatBuffer::limit).orElse(0)]; boolean[] inButtons = new boolean[buttonBuffer.map(ByteBuffer::limit).orElse(0)];
{ {
int i = 0; int i = 0;
while (buttonBuffer.isPresent() && buttonBuffer.get().hasRemaining()) { while (buttonBuffer.isPresent() && buttonBuffer.get().hasRemaining()) {