lib: Make fp_get_pollfds() fail when fp_init() wasn't called

So things can't be called out-of-order.
This commit is contained in:
Bastien Nocera 2018-10-11 17:19:21 +02:00
parent 36b696f433
commit a54d020c97

View file

@ -418,6 +418,8 @@ API_EXPORTED ssize_t fp_get_pollfds(struct fp_pollfd **pollfds)
ssize_t cnt = 0;
size_t i = 0;
g_return_val_if_fail (fpi_usb_ctx != NULL, -EIO);
usbfds = libusb_get_pollfds(fpi_usb_ctx);
if (!usbfds) {
*pollfds = NULL;