bugfix: improve fallback when StringEnum encounters null value (#2156)

This commit is contained in:
Brendan Forster
2020-03-17 15:09:15 -03:00
committed by GitHub
parent f6a9a47200
commit e9516bb6c1
3 changed files with 64 additions and 2 deletions
+12
View File
@@ -190,6 +190,18 @@ namespace Octokit.Internal
return base.DeserializeObject(value, payloadType);
}
if (ReflectionUtils.IsStringEnumWrapper(type))
{
// this check is a workaround for https://github.com/octokit/octokit.net/issues/2052
// as the API is returning a null value where the enum is
// expecting something like a string
//
// this should be removed once we can confirm the GitHub API
// is no longer returning a null for the parent Team's
// permission value
return Activator.CreateInstance(type, "null");
}
return base.DeserializeObject(value, type);
}