diff options
author | Richard Hughes <richard@hughsie.com> | 2022-09-06 08:17:14 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2022-09-06 10:01:51 +0100 |
commit | fd5f1d2b2bec8ccc3c12c2f1867a0a915543cfd9 (patch) | |
tree | 9e5c9643d3e011d063c066a60a2a91831d17eefc | |
parent | 56355bab0a0fc302e71f3716eeb577b8962cc56f (diff) | |
download | gusb-fd5f1d2b2bec8ccc3c12c2f1867a0a915543cfd9.tar.gz |
trivial: Check the handle before getting BOS descriptors
-rw-r--r-- | gusb/gusb-device.c | 4 |
1 files changed, 4 insertions, 0 deletions
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)) |