diff options
author | Pete Batard <pbatard@gmail.com> | 2010-02-19 17:16:41 +0000 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-02-19 17:16:41 +0000 |
commit | 2e83188d9c8a5a8eaab2c44a4eaa623df83fbefe (patch) | |
tree | ed3d611c4fae21578a0f68dc545c7f749e4446b8 | |
parent | 3a42fe7e65abde4cf035d3485c2312ee19a69964 (diff) | |
download | libusb-2e83188d9c8a5a8eaab2c44a4eaa623df83fbefe.tar.gz |
added detection of uninitialized devices on openr166
-rw-r--r-- | libusb/os/windows_usb.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/libusb/os/windows_usb.c b/libusb/os/windows_usb.c index e8e418d..3f85ac1 100644 --- a/libusb/os/windows_usb.c +++ b/libusb/os/windows_usb.c @@ -1559,6 +1559,12 @@ static int windows_get_active_config_descriptor(struct libusb_device *dev, unsig static int windows_open(struct libusb_device_handle *dev_handle) { struct windows_device_priv *priv = __device_priv(dev_handle->dev); + struct libusb_context *ctx = DEVICE_CTX(dev_handle->dev); + + if (priv->apib == NULL) { + usbi_err(ctx, "program assertion failed - device is not initialized"); + return LIBUSB_ERROR_NO_DEVICE; + } return priv->apib->open(dev_handle); } |