USB: Don't register the device if the DeviceType is none.

This commit is contained in:
arcum42 2022-12-18 00:14:31 -08:00 committed by refractionpcsx2
parent c46d316e95
commit 4de0fbe6b0
1 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@ OHCIPort& USB::GetOHCIPort(u32 port)
bool USB::CreateDevice(u32 port)
{
const Pcsx2Config::USBOptions::Port& portcfg = EmuConfig.USB.Ports[port];
const DeviceProxy* proxy = RegisterDevice::instance().Device(portcfg.DeviceType);
const DeviceProxy* proxy = (portcfg.DeviceType != DEVTYPE_NONE) ? RegisterDevice::instance().Device(portcfg.DeviceType) : nullptr;
if (!proxy)
return true;
@ -561,7 +561,7 @@ s32 USB::DeviceTypeNameToIndex(const std::string_view& device)
const char* USB::DeviceTypeIndexToName(s32 device)
{
RegisterDevice& rd = RegisterDevice::instance();
const DeviceProxy* proxy = rd.Device(device);
const DeviceProxy* proxy = (device != DEVTYPE_NONE) ? rd.Device(device) : nullptr;
return proxy ? proxy->TypeName() : "None";
}