فهرست منبع

Fix nullability errors in Jellyfin.Server

crobibero 4 سال پیش
والد
کامیت
e8675a6c24
2فایلهای تغییر یافته به همراه4 افزوده شده و 2 حذف شده
  1. 2 1
      Jellyfin.Server/Formatters/CssOutputFormatter.cs
  2. 2 1
      Jellyfin.Server/Formatters/XmlOutputFormatter.cs

+ 2 - 1
Jellyfin.Server/Formatters/CssOutputFormatter.cs

@@ -30,7 +30,8 @@ namespace Jellyfin.Server.Formatters
         /// <returns>Write stream task.</returns>
         public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
         {
-            return context.HttpContext.Response.WriteAsync(context.Object?.ToString());
+            var stringResponse = context.Object?.ToString();
+            return stringResponse == null ? Task.CompletedTask : context.HttpContext.Response.WriteAsync(stringResponse);
         }
     }
 }

+ 2 - 1
Jellyfin.Server/Formatters/XmlOutputFormatter.cs

@@ -26,7 +26,8 @@ namespace Jellyfin.Server.Formatters
         /// <inheritdoc />
         public override Task WriteResponseBodyAsync(OutputFormatterWriteContext context, Encoding selectedEncoding)
         {
-            return context.HttpContext.Response.WriteAsync(context.Object?.ToString());
+            var stringResponse = context.Object?.ToString();
+            return stringResponse == null ? Task.CompletedTask : context.HttpContext.Response.WriteAsync(stringResponse);
         }
     }
 }