HIDv4: Check Device Not Null Before Attaching

This commit is contained in:
deReeperJosh 2023-09-26 18:10:29 +01:00
parent f8445782bf
commit d0de837efd

View File

@ -59,6 +59,8 @@ std::optional<IPCReply> USB_HIDv4::IOCtl(const IOCtlRequest& request)
if (request.buffer_in == 0 || request.buffer_in_size != 32)
return IPCReply(IPC_EINVAL);
const auto device = GetDeviceByIOSID(memory.Read_U32(request.buffer_in + 16));
if (!device)
return IPCReply(IPC_ENOENT);
if (!device->Attach())
return IPCReply(IPC_EINVAL);
return HandleTransfer(device, request.request,