USB: Don't crash and burn if there is no ini file for pcsx2.

This commit is contained in:
arcum42 2022-12-17 23:35:01 -08:00 committed by refractionpcsx2
parent 8cf430ef7e
commit c46d316e95
1 changed files with 3 additions and 0 deletions

View File

@ -115,6 +115,9 @@ public:
DeviceProxy* Device(int index)
{
if (index < 0)
return nullptr; // Don't try to go backwards at the beginning of an iterator and crash and burn when pcsx2 is run for the first time.
auto it = registerDeviceMap.begin();
std::advance(it, index);
if (it != registerDeviceMap.end())