diff options
author | elias <[email protected]> | 2006-12-25 09:31:34 +0000 |
---|---|---|
committer | elias <[email protected]> | 2006-12-25 09:31:34 +0000 |
commit | 7671e79527ec1f56a845c9f689bf09cc0c0643fc (patch) | |
tree | 6b4ac8f76218ff45be57aac926a57edaf8762afa | |
parent | bd9bcf646a4938354edd623a17e0f4443365f817 (diff) |
Linux ~: More bounds checks
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@175 e343933a-64c8-49c5-92b1-88f2ce3e89e8
-rw-r--r-- | plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java b/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java index 77d7da7..8ea012e 100644 --- a/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java +++ b/plugins/linux/src/java/net/java/games/input/LinuxNativeTypesMap.java @@ -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; |