From 716eb7b890000c38e7ecbd3b30c2485eb77ff0d2 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 18 May 2009 12:46:04 -0700 Subject: [PATCH] Fix #2465 (Calibre fails after running GlobeTrotter Connect on OS X 10.5) --- src/calibre/devices/usbobserver/usbobserver.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/usbobserver/usbobserver.c b/src/calibre/devices/usbobserver/usbobserver.c index 20b4944d41..051901f849 100644 --- a/src/calibre/devices/usbobserver/usbobserver.c +++ b/src/calibre/devices/usbobserver/usbobserver.c @@ -71,12 +71,16 @@ usbobserver_get_usb_devices(PyObject *self, PyObject *args) { plugInInterface = NULL; dev = NULL; //Create an intermediate plugin kr = IOCreatePlugInInterfaceForService(usbDevice, kIOUSBDeviceUserClientTypeID, kIOCFPlugInInterfaceID, &plugInInterface, &score); - if ((kIOReturnSuccess != kr) || !plugInInterface) - printf("Unable to create a plug-in (%08x)\n", kr); + if ((kIOReturnSuccess != kr) || !plugInInterface) { + printf("Unable to create a plug-in (%08x)\n", kr); continue; + } //Now create the device interface HRESULT result = (*plugInInterface)->QueryInterface(plugInInterface, CFUUIDGetUUIDBytes(kIOUSBDeviceInterfaceID), (LPVOID)&dev); - if (result || !dev) printf("Couldn't create a device interface (%08x)\n", (int) result); + if (result || !dev) { + printf("Couldn't create a device interface (%08x)\n", (int) result); + continue; + } kr = (*dev)->GetDeviceVendor(dev, &vendor); kr = (*dev)->GetDeviceProduct(dev, &product);