[runner]Fix crashes caused by wrong setting AllowDataDiagnostics registry value (#37015)

* Fix setting registry value

* Prevent future similar crashes
This commit is contained in:
Stefan Markovic
2025-01-22 19:49:31 +01:00
committed by GitHub
parent 422096b907
commit b6b941c55b
2 changed files with 7 additions and 8 deletions

View File

@@ -20,16 +20,16 @@ namespace Microsoft.PowerToys.Telemetry
try
{
registryValue = Registry.GetValue(DataDiagnosticsRegistryKey, DataDiagnosticsRegistryValueName, 0);
if (registryValue is not null)
{
return (int)registryValue == 1 ? true : false;
}
}
catch
{
}
if (registryValue is not null)
{
return (int)registryValue == 1 ? true : false;
}
return false;
}