In some cases, jmw starts duing start up when a USB hub is present (some models). It looks, as if the USB device is considered to be a USB joystick, But the joystick does not have an analog stick which causes a null pointer exception, since
final FloatBuffer axisValues = glfwGetJoystickAxes(entry.getKey());
is zero, and axisValues is used.
The following changes in GlfwJoystivkInput.java solve this issue:
package com.jme3.input.lwjgl;
...
public class GlfwJoystickInput implements JoyInput {
...
@Override
public Joystick[] loadJoysticks(final InputManager inputManager) {
for (int i = 0; i < GLFW_JOYSTICK_LAST; i++) {
if (glfwJoystickPresent(i)) {
final String name = glfwGetJoystickName(i);
final GlfwJoystick joystick = new GlfwJoystick(inputManager, this, i, name);
joysticks.put(i, joystick);
final FloatBuffer floatBuffer = glfwGetJoystickAxes(i);
int axisIndex = 0;
if (floatBuffer != null) {
while (floatBuffer.hasRemaining()) {
floatBuffer.get();
final String logicalId = JoystickCompatibilityMappings.remapAxis(joystick.getName(), convertAxisIndex(axisIndex));
final JoystickAxis joystickAxis = new DefaultJoystickAxis(inputManager, joystick, axisIndex, convertAxisIndex(axisIndex), logicalId, true, false, 0.0f);
joystick.addAxis(axisIndex, joystickAxis);
axisIndex++;
}
}
final ByteBuffer byteBuffer = glfwGetJoystickButtons(i);
int buttonIndex = 0;
if (byteBuffer != null) {
while (byteBuffer.hasRemaining()) {
byteBuffer.get();
final String logicalId = JoystickCompatibilityMappings.remapButton(joystick.getName(), String.valueOf(buttonIndex));
final JoystickButton button = new DefaultJoystickButton(inputManager, joystick, buttonIndex, String.valueOf(buttonIndex), logicalId);
joystick.addButton(button);
joyButtonPressed.put(button, false);
buttonIndex++;
}
}
}
}
return joysticks.values().toArray(new GlfwJoystick[joysticks.size()]);
}
In some cases, jmw starts duing start up when a USB hub is present (some models). It looks, as if the USB device is considered to be a USB joystick, But the joystick does not have an analog stick which causes a null pointer exception, since
final FloatBuffer axisValues = glfwGetJoystickAxes(entry.getKey());
is zero, and axisValues is used.
The following changes in GlfwJoystivkInput.java solve this issue:
package com.jme3.input.lwjgl;
...
public class GlfwJoystickInput implements JoyInput {
...