diff options
author | endolf <[email protected]> | 2005-09-01 20:02:57 +0000 |
---|---|---|
committer | endolf <[email protected]> | 2005-09-01 20:02:57 +0000 |
commit | 47e2f395874e778377e88f724c935c8979e64665 (patch) | |
tree | 73edfce76f7c425f6b0de8b4b2e4253e8393563d /plugins/DX8 | |
parent | 2e8c36bfdf4d0bb14c72bd84d98382c2faa83f15 (diff) |
Added debug for an array out of bounds error that is being seen
git-svn-id: file:///home/sven/projects/JOGL/git-svn/svn-server-sync/jinput/trunk@123 e343933a-64c8-49c5-92b1-88f2ce3e89e8
Diffstat (limited to 'plugins/DX8')
-rw-r--r-- | plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java b/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java index a09267d..58299b7 100644 --- a/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java +++ b/plugins/DX8/src/java/net/java/games/input/DirectInputAxis.java @@ -145,7 +145,12 @@ class DirectInputAxis extends AbstractComponent { * @return A float between -1.0 and 1.0 */ public float getPollData() { - int data = ((device.data[offset] >> bitshift)&bitmask); + int data = 0; + try { + data = ((device.data[offset] >> bitshift)&bitmask); + } catch (ArrayIndexOutOfBoundsException) { + System.out.println("Tried to get data for axis: " + this.getName() + ", device.data[" + offset + "] does not exists as device.data is only " + device.data.length + " long.") + } if ((type&DIDFT_BUTTON) != 0 ) { return (float)((data&0x80)>>7); } else if ((type&DIDFT_AXIS)!=0){ // all axes are set for -32768 to 32738 |