Fixed problem when registry key does not exist

This commit is contained in:
Travis Nickles 2018-07-18 00:56:05 -05:00
parent 46dc83f61c
commit 04140081ce

View File

@ -87,7 +87,16 @@ namespace DS4Windows
public void ScanPurgeHidGuard()
{
RegistryKey tempkey = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Services\HidGuardian\Parameters\Whitelist");
string[] subkeys = tempkey.GetSubKeyNames();
string[] subkeys = null;
if (tempkey != null)
{
subkeys = tempkey.GetSubKeyNames();
}
else
{
subkeys = new string[0];
}
bool processExists = false;
for (int ind = 0, arlen = subkeys.Length; ind < arlen; ind++)
{