Fix crash on resume when X360 Controller is in use

This commit is contained in:
Kamil Trzciński 2022-11-28 17:33:22 +01:00
parent 76408ce20b
commit f261424932
2 changed files with 10 additions and 1 deletions

View file

@ -33,3 +33,4 @@ It does help this project on being supported.
- Properly apply X360 mappings for Back Panel keys
- Setting `Keyboard[KEY] = false` and `Mouse[KEY] = false` does not cancel the press
- Fix crash on startup when Steam is missing
- Fix crash on resume when X360 Controller is in use

View file

@ -114,7 +114,15 @@ namespace SteamController.Devices
if (isConnected && submitReport)
{
device?.SubmitReport();
try
{
device?.SubmitReport();
}
catch (VigemInvalidTargetException)
{
device?.Disconnect();
isConnected = false;
}
}
if (FeedbackReceived is not null && FeedbackReceived.Value.Add(FeedbackTimeout) < DateTime.Now)