Added reference check while unplugging virtual device

This commit is contained in:
Travis Nickles 2020-04-05 15:22:08 -05:00
parent 87bba30914
commit 21d65e01e9

View File

@ -487,9 +487,12 @@ namespace DS4Windows
if (!useDInputOnly[index])
{
//OutContType contType = Global.OutContType[index];
string tempType = outputDevices[index].GetDeviceType();
LogDebug("Unplugging " + tempType + " Controller for input #" + (index + 1), false);
OutputDevice dev = outputDevices[index];
if (dev != null)
{
string tempType = dev.GetDeviceType();
LogDebug("Unplugging " + tempType + " Controller for input #" + (index + 1), false);
outputDevices[index] = null;
activeOutDevType[index] = OutContType.None;
outputslotMan.DeferredRemoval(dev, index, outputDevices, immediate);
@ -498,6 +501,7 @@ namespace DS4Windows
useDInputOnly[index] = true;
}
}
}
public bool Start(bool showlog = true)
{