mirror of
https://github.com/shadowfacts/jinput-arm64.git
synced 2026-01-08 17:59:57 +01:00
Linux ~: More bounds checks
This commit is contained in:
parent
9d211951c1
commit
02196352eb
|
|
@ -751,7 +751,13 @@ class LinuxNativeTypesMap {
|
|||
* @return The jinput id
|
||||
*/
|
||||
public static Component.Identifier getRelAxisID(int nativeID) {
|
||||
Component.Identifier retval = INSTANCE.relAxesIDs[nativeID];
|
||||
Component.Identifier retval = null;
|
||||
try {
|
||||
retval = INSTANCE.relAxesIDs[nativeID];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
System.out.println("INSTANCE.relAxesIDis only " + INSTANCE.relAxesIDs.length + " long, so " + nativeID + " not contained");
|
||||
//ignore, pretend it was null
|
||||
}
|
||||
if(retval == null) {
|
||||
retval = Component.Identifier.Axis.SLIDER_VELOCITY;
|
||||
INSTANCE.relAxesIDs[nativeID] = retval;
|
||||
|
|
@ -784,8 +790,12 @@ class LinuxNativeTypesMap {
|
|||
*/
|
||||
public static Component.Identifier getButtonID(int nativeID) {
|
||||
Component.Identifier retval = null;
|
||||
if (nativeID >= 0 && nativeID < INSTANCE.buttonIDs.length)
|
||||
try {
|
||||
retval = INSTANCE.buttonIDs[nativeID];
|
||||
} catch (ArrayIndexOutOfBoundsException e) {
|
||||
System.out.println("INSTANCE.buttonIDs is only " + INSTANCE.buttonIDs.length + " long, so " + nativeID + " not contained");
|
||||
//ignore, pretend it was null
|
||||
}
|
||||
if(retval == null) {
|
||||
retval = Component.Identifier.Key.UNKNOWN;
|
||||
INSTANCE.buttonIDs[nativeID] = retval;
|
||||
|
|
|
|||
Loading…
Reference in a new issue