aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers/DynamicHlsController.cs
diff options
context:
space:
mode:
authorcrobibero <cody@robibe.ro>2020-11-13 11:24:46 -0700
committercrobibero <cody@robibe.ro>2020-11-13 11:24:46 -0700
commit95ebb9a55ace6c544fa7fa15d0a255a5cee752a8 (patch)
treef5ce2c6ea994d63712d45772ad712ac6bcf79ab6 /Jellyfin.Api/Controllers/DynamicHlsController.cs
parent5f52a58e785fa4ae06fa07a93b81c1e7547ac9f3 (diff)
Use null coalescing when possible
Diffstat (limited to 'Jellyfin.Api/Controllers/DynamicHlsController.cs')
-rw-r--r--Jellyfin.Api/Controllers/DynamicHlsController.cs13
1 files changed, 2 insertions, 11 deletions
diff --git a/Jellyfin.Api/Controllers/DynamicHlsController.cs b/Jellyfin.Api/Controllers/DynamicHlsController.cs
index 64bea999f..783deebdc 100644
--- a/Jellyfin.Api/Controllers/DynamicHlsController.cs
+++ b/Jellyfin.Api/Controllers/DynamicHlsController.cs
@@ -1348,11 +1348,7 @@ namespace Jellyfin.Api.Controllers
var mapArgs = state.IsOutputVideo ? _encodingHelper.GetMapArgs(state) : string.Empty;
- var directory = Path.GetDirectoryName(outputPath);
- if (directory == null)
- {
- throw new ResourceNotFoundException(nameof(directory));
- }
+ var directory = Path.GetDirectoryName(outputPath) ?? throw new ResourceNotFoundException(nameof(outputPath));
var outputTsArg = Path.Combine(directory, Path.GetFileNameWithoutExtension(outputPath)) + "%d" + GetSegmentFileExtension(state.Request.SegmentContainer);
@@ -1572,12 +1568,7 @@ namespace Jellyfin.Api.Controllers
private string GetSegmentPath(StreamState state, string playlist, int index)
{
- var folder = Path.GetDirectoryName(playlist);
- if (folder == null)
- {
- throw new ResourceNotFoundException(nameof(folder));
- }
-
+ var folder = Path.GetDirectoryName(playlist) ?? throw new ResourceNotFoundException(nameof(playlist));
var filename = Path.GetFileNameWithoutExtension(playlist);
return Path.Combine(folder, filename + index.ToString(CultureInfo.InvariantCulture) + GetSegmentFileExtension(state.Request.SegmentContainer));