Make sure a USB context exists before reporting input

This commit is contained in:
Cameron Gutman 2017-05-17 20:38:55 -07:00
parent 75aabd6471
commit 1434be262c

View File

@ -1120,6 +1120,9 @@ public class ControllerHandler implements InputManager.InputDeviceListener, UsbD
float rightStickX, float rightStickY, float rightStickX, float rightStickY,
float leftTrigger, float rightTrigger) { float leftTrigger, float rightTrigger) {
UsbDeviceContext context = usbDeviceContexts.get(controllerId); UsbDeviceContext context = usbDeviceContexts.get(controllerId);
if (context == null) {
return;
}
Vector2d leftStickVector = populateCachedVector(leftStickX, leftStickY); Vector2d leftStickVector = populateCachedVector(leftStickX, leftStickY);