diff options
| author | Bond_009 <bond.009@outlook.com> | 2022-01-07 11:48:59 +0100 |
|---|---|---|
| committer | Bond_009 <bond.009@outlook.com> | 2022-01-10 10:57:32 +0100 |
| commit | 05836c8cd31ceaa3b84c2fa7dd04dfdbc9d7cc3c (patch) | |
| tree | 257bfef6ce7e223d8d4b5cd9c042088b1f081e93 /Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs | |
| parent | d24683f0abefe42daae366745422798079705243 (diff) | |
Fix warning SA1414 and CA1849
Diffstat (limited to 'Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs index b1ce7b2b3..ab4beb15b 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/SharedHttpStream.cs @@ -1,5 +1,3 @@ -#nullable disable - #pragma warning disable CS1591 using System; @@ -51,7 +49,7 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts var url = mediaSource.Path; - Directory.CreateDirectory(Path.GetDirectoryName(TempFilePath)); + Directory.CreateDirectory(Path.GetDirectoryName(TempFilePath) ?? throw new InvalidOperationException("Path can't be a root directory.")); var typeName = GetType().Name; Logger.LogInformation("Opening {StreamType} Live stream from {Url}", typeName, url); @@ -94,14 +92,8 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts // OpenedMediaSource.SupportsDirectPlay = false; // OpenedMediaSource.SupportsDirectStream = true; // OpenedMediaSource.SupportsTranscoding = true; - await taskCompletionSource.Task.ConfigureAwait(false); - if (taskCompletionSource.Task.Exception != null) - { - // Error happened while opening the stream so raise the exception again to inform the caller - throw taskCompletionSource.Task.Exception; - } - - if (!taskCompletionSource.Task.Result) + var res = await taskCompletionSource.Task.ConfigureAwait(false); + if (!res) { Logger.LogWarning("Zero bytes copied from stream {StreamType} to {FilePath} but no exception raised", GetType().Name, TempFilePath); throw new EndOfStreamException(string.Format(CultureInfo.InvariantCulture, "Zero bytes copied from stream {0}", GetType().Name)); |
