diff options
author | Richard Hughes <richard@hughsie.com> | 2023-02-06 14:42:25 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2023-02-06 14:42:25 +0000 |
commit | bc465521c2f58b5aea4513266780695d0e7fa243 (patch) | |
tree | b940638dff5c0ca94758ebac842b204c7b0878c4 | |
parent | 9bc67208a25fa8e1739161b81af8160118945623 (diff) | |
download | gusb-bc465521c2f58b5aea4513266780695d0e7fa243.tar.gz |
trivial: Fix critical warning when emulating devices
-rw-r--r-- | gusb/gusb-interface.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gusb/gusb-interface.c b/gusb/gusb-interface.c index 2aa67df..e6cf84f 100644 --- a/gusb/gusb-interface.c +++ b/gusb/gusb-interface.c @@ -376,8 +376,8 @@ g_usb_interface_get_extra(GUsbInterface *self) * * Gets interface endpoints. * - * Return value: (transfer container) (element-type GUsbEndpoint): an array of endpoints, or %NULL - *on failure + * Return value: (transfer container) (element-type GUsbEndpoint): an array of endpoints, + * or %NULL on failure. * * Since: 0.3.3 **/ @@ -385,5 +385,7 @@ GPtrArray * g_usb_interface_get_endpoints(GUsbInterface *self) { g_return_val_if_fail(G_USB_IS_INTERFACE(self), NULL); + if (self->endpoints == NULL) + return NULL; return g_ptr_array_ref(self->endpoints); } |