Merge pull request #4605 from hawken93/bugfix-libraryerror

Allow JsonGuidConverter to read null
This commit is contained in:
Bond-009 2020-11-28 16:23:56 +01:00 committed by GitHub
commit 1cd3b3fc41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,7 +11,11 @@ namespace MediaBrowser.Common.Json.Converters
{ {
/// <inheritdoc /> /// <inheritdoc />
public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) public override Guid Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
=> new Guid(reader.GetString()); {
var guidStr = reader.GetString();
return guidStr == null ? Guid.Empty : new Guid(guidStr);
}
/// <inheritdoc /> /// <inheritdoc />
public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options) public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options)