From 2e83188d9c8a5a8eaab2c44a4eaa623df83fbefe Mon Sep 17 00:00:00 2001 From: Pete Batard Date: Fri, 19 Feb 2010 17:16:41 +0000 Subject: added detection of uninitialized devices on open --- libusb/os/windows_usb.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'libusb/os') 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); } -- cgit v1.2.1