summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPete Batard <pbatard@gmail.com>2010-02-19 17:16:41 +0000
committerPete Batard <pbatard@gmail.com>2010-02-19 17:16:41 +0000
commit2e83188d9c8a5a8eaab2c44a4eaa623df83fbefe (patch)
treeed3d611c4fae21578a0f68dc545c7f749e4446b8
parent3a42fe7e65abde4cf035d3485c2312ee19a69964 (diff)
downloadlibusb-2e83188d9c8a5a8eaab2c44a4eaa623df83fbefe.tar.gz
added detection of uninitialized devices on openr166
-rw-r--r--libusb/os/windows_usb.c6
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);
}