From b251b846f258dd4fd3ab352ea56a63727e0f3486 Mon Sep 17 00:00:00 2001 From: elias Date: Wed, 23 Aug 2006 07:53:04 +0000 Subject: [PATCH] DirectInput: Don't fail entire enumeration because of one device failure --- .../src/java/net/java/games/input/IDirectInput.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/windows/src/java/net/java/games/input/IDirectInput.java b/plugins/windows/src/java/net/java/games/input/IDirectInput.java index 8cef150..dea99d5 100644 --- a/plugins/windows/src/java/net/java/games/input/IDirectInput.java +++ b/plugins/windows/src/java/net/java/games/input/IDirectInput.java @@ -78,7 +78,12 @@ final class IDirectInput { * native side will clean up in case of an exception */ private final void addDevice(long address, byte[] instance_guid, byte[] product_guid, int dev_type, int dev_subtype, String instance_name, String product_name) throws IOException { - devices.add(new IDirectInputDevice(window, address, instance_guid, product_guid, dev_type, dev_subtype, instance_name, product_name)); + try { + IDirectInputDevice device = new IDirectInputDevice(window, address, instance_guid, product_guid, dev_type, dev_subtype, instance_name, product_name); + devices.add(device); + } catch (IOException e) { + DefaultControllerEnvironment.logln("Failed to initialize device " + product_name + " because of: " + e); + } } public final void releaseDevices() {