USB: Add a missing NULL check in Hub constructor.

This case is probably very rare, though.
This commit is contained in:
Augustin Cavalier 2024-11-12 21:52:02 -05:00
parent 8500b11c43
commit 75a4dfe4a1

View File

@ -69,14 +69,15 @@ Hub::Hub(Object *parent, int8 hubAddress, uint8 hubPort,
usb_interface_list *list = Configuration()->interface;
Object *object = GetStack()->GetObject(list->active->endpoint[0].handle);
if (object && (object->Type() & USB_OBJECT_INTERRUPT_PIPE) != 0) {
if (object != NULL && (object->Type() & USB_OBJECT_INTERRUPT_PIPE) != 0) {
fInterruptPipe = (InterruptPipe *)object;
fInterruptPipe->QueueInterrupt(fInterruptStatus,
sizeof(fInterruptStatus), InterruptCallback, this);
} else {
TRACE_ALWAYS("no interrupt pipe found\n");
}
object->ReleaseReference();
if (object != NULL)
object->ReleaseReference();
// Wait some time before powering up the ports
if (!isRootHub)