Skip to content

Commit 5c01227

Browse files
committed
Update EnumHelper.cs
Check for null
1 parent 505df5c commit 5c01227

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Source/Common/EnumHelper.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ public static bool TryParseEnumFromSchemaUri(
6060
string? value,
6161
out object? result)
6262
{
63+
#if NET6_0_OR_GREATER
64+
ArgumentNullException.ThrowIfNull(enumType);
65+
#else
66+
if (enumType is null)
67+
{
68+
throw new ArgumentNullException(nameof(enumType));
69+
}
70+
#endif
6371
string? enumString;
6472
if (value is not null && value.Length > Constants.HttpSchemaOrgUrl.Length && value.StartsWith(Constants.HttpSchemaOrgUrl, StringComparison.OrdinalIgnoreCase))
6573
{

0 commit comments

Comments
 (0)