diff options
Diffstat (limited to 'Emby.Server.Implementations/Library/LiveStreamHelper.cs')
| -rw-r--r-- | Emby.Server.Implementations/Library/LiveStreamHelper.cs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/Emby.Server.Implementations/Library/LiveStreamHelper.cs b/Emby.Server.Implementations/Library/LiveStreamHelper.cs index d4aeae41a..0ebfe3ae7 100644 --- a/Emby.Server.Implementations/Library/LiveStreamHelper.cs +++ b/Emby.Server.Implementations/Library/LiveStreamHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - #pragma warning disable CS1591 using System; @@ -37,16 +35,16 @@ namespace Emby.Server.Implementations.Library _appPaths = appPaths; } - public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, string cacheKey, bool addProbeDelay, CancellationToken cancellationToken) + public async Task AddMediaInfoWithProbe(MediaSourceInfo mediaSource, bool isAudio, string? cacheKey, bool addProbeDelay, CancellationToken cancellationToken) { var originalRuntime = mediaSource.RunTimeTicks; var now = DateTime.UtcNow; - MediaInfo mediaInfo = null; + MediaInfo? mediaInfo = null; var cacheFilePath = string.IsNullOrEmpty(cacheKey) ? null : Path.Combine(_appPaths.CachePath, "mediainfo", cacheKey.GetMD5().ToString("N", CultureInfo.InvariantCulture) + ".json"); - if (!string.IsNullOrEmpty(cacheKey)) + if (cacheFilePath is not null) { try { @@ -91,7 +89,7 @@ namespace Emby.Server.Implementations.Library if (cacheFilePath is not null) { - Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath)); + Directory.CreateDirectory(Path.GetDirectoryName(cacheFilePath) ?? throw new InvalidOperationException("Path can't be a root directory.")); FileStream createStream = AsyncFile.OpenWrite(cacheFilePath); await using (createStream.ConfigureAwait(false)) { |
