summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--liboctopus/octopus.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/liboctopus/octopus.c b/liboctopus/octopus.c
index 9111b0d..641635b 100644
--- a/liboctopus/octopus.c
+++ b/liboctopus/octopus.c
@@ -162,6 +162,9 @@ int octopus_open_dev(struct octopus_context *octopus, struct usb_device *dev)
if (!(octopus->usb_handle = usb_open(dev)))
octopus_error_return(-3,"can't open usb device");
+ if (dev->config == NULL)
+ octopus_error_return(-7, "cant access configuration for given usb device");
+
if (usb_set_configuration (octopus->usb_handle,dev->config[0].bConfigurationValue) < 0)
octopus_error_return(-4,"can't set configuration for given usb device");