aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/usb.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hw/usb.c b/hw/usb.c
index bacdc81bfc..9976f81bd7 100644
--- a/hw/usb.c
+++ b/hw/usb.c
@@ -315,6 +315,10 @@ int usb_handle_packet(USBDevice *dev, USBPacket *p)
{
int ret;
+ if (dev == NULL) {
+ return USB_RET_NODEV;
+ }
+
assert(p->owner == NULL);
ret = usb_device_handle_packet(dev, p);
if (ret == USB_RET_ASYNC) {