Don't crash when no devices are present

This commit is contained in:
Bastien Nocera 2010-08-18 11:17:20 +01:00
parent 73561989dd
commit 9608ab3707

View file

@ -464,10 +464,12 @@ static struct fp_driver *find_supporting_driver(libusb_device *udev,
}
} while ((elem = g_slist_next(elem)));
fp_dbg("selected driver %s supports USB device %04x:%04x",
best_drv->name, dsc.idVendor, dsc.idProduct);
*devtype = best_devtype;
*usb_id = best_usb_id;
if (best_drv != NULL) {
fp_dbg("selected driver %s supports USB device %04x:%04x",
best_drv->name, dsc.idVendor, dsc.idProduct);
*devtype = best_devtype;
*usb_id = best_usb_id;
}
return best_drv;
}