Skip to content

Commit

Permalink
Fix erroneous "globalizationMode" local naming in PlatformDetection (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
stephentoub authored Jul 10, 2021
1 parent fc5df59 commit 004feb8
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,9 @@ public static string GetDistroVersionString()

private static bool GetStaticNonPublicBooleanPropertyValue(string typeName, string propertyName)
{
Type globalizationMode = Type.GetType(typeName);
if (globalizationMode != null)
if (Type.GetType(typeName)?.GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Static)?.GetMethod is MethodInfo mi)
{
MethodInfo methodInfo = globalizationMode.GetProperty(propertyName, BindingFlags.NonPublic | BindingFlags.Static)?.GetMethod;
if (methodInfo != null)
{
return (bool)methodInfo.Invoke(null, null);
}
return (bool)mi.Invoke(null, null);
}

return false;
Expand Down

0 comments on commit 004feb8

Please sign in to comment.