The Free Software Media System - Server Backend & API
Fix nullability errors in Jellyfin.Server
crobiberoe8675a6c24eb
diff --git a/Jellyfin.Server/Formatters/CssOutputFormatter.cs b/Jellyfin.Server/Formatters/CssOutputFormatter.csindex b3771b7fe6..e8dd48e4e6 100644--- a/Jellyfin.Server/Formatters/CssOutputFormatter.cs+++ b/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);}}}diff --git a/Jellyfin.Server/Formatters/XmlOutputFormatter.cs b/Jellyfin.Server/Formatters/XmlOutputFormatter.csindex 01d99d7c87..be0baea2d2 100644--- a/Jellyfin.Server/Formatters/XmlOutputFormatter.cs+++ b/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);}}}