mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-16 16:16:04 -04:00
Fix crash due to crash when a controller isn't recognized
This commit is contained in:
parent
7835a76a95
commit
2fa4a2756e
@ -27,8 +27,9 @@ public class GamepadJoystick {
|
|||||||
this.verticalAxis = verticalAxis;
|
this.verticalAxis = verticalAxis;
|
||||||
this.horizontalAxis = horizontalAxis;
|
this.horizontalAxis = horizontalAxis;
|
||||||
|
|
||||||
deadzone = Math.max(device.getMotionRange(verticalAxis).getFlat(),
|
//Some controllers aren't recognized as such by android, so we fallback to a default value of 0.2
|
||||||
device.getMotionRange(horizontalAxis).getFlat()) * 2f;
|
deadzone = device != null ? Math.max(device.getMotionRange(verticalAxis).getFlat(),
|
||||||
|
device.getMotionRange(horizontalAxis).getFlat()) * 2f : 0.2f;
|
||||||
|
|
||||||
if(deadzone < 0.15) deadzone = 0.15f;
|
if(deadzone < 0.15) deadzone = 0.15f;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user