From be8cedc232a87b77e2e22f56ff729579d380d1c6 Mon Sep 17 00:00:00 2001 From: schlaepfer Date: Wed, 9 Aug 2006 13:47:22 +0000 Subject: [PATCH] - crash with invalid device_handle for usb_release_interface fixed git-svn-id: https://svn.code.sf.net/p/libusbjava/code/trunk@155 94ad28fe-ef68-46b1-9651-e7ae4fcf1c4c --- java/src/ch/ntb/usb/Device.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/java/src/ch/ntb/usb/Device.java b/java/src/ch/ntb/usb/Device.java index b51f4df..8337ebc 100644 --- a/java/src/ch/ntb/usb/Device.java +++ b/java/src/ch/ntb/usb/Device.java @@ -146,11 +146,9 @@ public class Device { } release_interface(usb_dev_handle, interface_); if (LibusbWin.usb_close(usb_dev_handle) < 0) { - usb_dev_handle = 0; throw new USBException("LibusbWin.usb_close: " + LibusbWin.usb_strerror()); } - usb_dev_handle = 0; maxPacketSize = -1; logger.info("device closed"); } @@ -167,6 +165,7 @@ public class Device { throw new USBException("invalid device handle"); } if (LibusbWin.usb_reset(usb_dev_handle) < 0) { + usb_dev_handle = 0; throw new USBException("LibusbWin.usb_reset: " + LibusbWin.usb_strerror()); } @@ -342,6 +341,7 @@ public class Device { private void release_interface(int dev_handle, int interface_) throws USBException { if (LibusbWin.usb_release_interface(dev_handle, interface_) < 0) { + usb_dev_handle = 0; throw new USBException("LibusbWin.usb_release_interface: " + LibusbWin.usb_strerror()); }