aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Helpers
diff options
context:
space:
mode:
Diffstat (limited to 'Jellyfin.Api/Helpers')
-rw-r--r--Jellyfin.Api/Helpers/HlsHelpers.cs7
-rw-r--r--Jellyfin.Api/Helpers/TranscodingJobHelper.cs14
2 files changed, 4 insertions, 17 deletions
diff --git a/Jellyfin.Api/Helpers/HlsHelpers.cs b/Jellyfin.Api/Helpers/HlsHelpers.cs
index 707d1cd104..bcf0da319c 100644
--- a/Jellyfin.Api/Helpers/HlsHelpers.cs
+++ b/Jellyfin.Api/Helpers/HlsHelpers.cs
@@ -45,11 +45,8 @@ namespace Jellyfin.Api.Helpers
while (!reader.EndOfStream)
{
- var line = await reader.ReadLineAsync().ConfigureAwait(false);
- if (line == null)
- {
- throw new ResourceNotFoundException(nameof(line));
- }
+ var line = await reader.ReadLineAsync().ConfigureAwait(false)
+ ?? throw new ResourceNotFoundException(nameof(reader));
if (line.IndexOf("#EXTINF:", StringComparison.OrdinalIgnoreCase) != -1)
{
diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs
index 4ec0c576aa..8466241838 100644
--- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs
+++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs
@@ -196,12 +196,7 @@ namespace Jellyfin.Api.Helpers
/// <param name="state">The state.</param>
private async void OnTranscodeKillTimerStopped(object? state)
{
- var job = (TranscodingJobDto?)state;
- if (job == null)
- {
- throw new ResourceNotFoundException(nameof(job));
- }
-
+ var job = state as TranscodingJobDto ?? throw new ResourceNotFoundException(nameof(state));
if (!job.HasExited && job.Type != TranscodingJobType.Progressive)
{
var timeSinceLastPing = (DateTime.UtcNow - job.LastPingDate).TotalMilliseconds;
@@ -494,12 +489,7 @@ namespace Jellyfin.Api.Helpers
CancellationTokenSource cancellationTokenSource,
string? workingDirectory = null)
{
- var directory = Path.GetDirectoryName(outputPath);
- if (directory == null)
- {
- throw new ResourceNotFoundException(nameof(directory));
- }
-
+ var directory = Path.GetDirectoryName(outputPath) ?? throw new ResourceNotFoundException(nameof(outputPath));
Directory.CreateDirectory(directory);
await AcquireResources(state, cancellationTokenSource).ConfigureAwait(false);