Browse Source

allow JsonGuidConverter to read null

hawken 4 năm trước cách đây
mục cha
commit
f9f0df88d5
1 tập tin đã thay đổi với 5 bổ sung1 xóa
  1. 5 1
      MediaBrowser.Common/Json/Converters/JsonGuidConverter.cs

+ 5 - 1
MediaBrowser.Common/Json/Converters/JsonGuidConverter.cs

@@ -11,7 +11,11 @@ namespace MediaBrowser.Common.Json.Converters
     {
         /// <inheritdoc />
         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 />
         public override void Write(Utf8JsonWriter writer, Guid value, JsonSerializerOptions options)