From fd5f1d2b2bec8ccc3c12c2f1867a0a915543cfd9 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Tue, 6 Sep 2022 08:17:14 +0100 Subject: trivial: Check the handle before getting BOS descriptors --- gusb/gusb-device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c index a75bebf..2d7e46a 100644 --- a/gusb/gusb-device.c +++ b/gusb/gusb-device.c @@ -902,6 +902,10 @@ g_usb_device_get_bos_descriptors(GUsbDevice *self, GError **error) "not supported for emulated device"); return NULL; } + if (priv->handle == NULL) { + g_usb_device_not_open_error(self, error); + return NULL; + } rc = libusb_get_bos_descriptor(priv->handle, &bos); if (!g_usb_device_libusb_error_to_gerror(self, rc, error)) -- cgit v1.2.1