From 2f8bf92fb80c8bf8568e8b22aba31a839b8862d3 Mon Sep 17 00:00:00 2001 From: Bruno Ferreira Date: Sun, 17 May 2026 09:01:39 -0300 Subject: fix: add null check for non-existent program in GetProgram (#16858) fix: add null check for non-existent program in GetProgram --- Jellyfin.Api/Controllers/LiveTvController.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'Jellyfin.Api/Controllers/LiveTvController.cs') diff --git a/Jellyfin.Api/Controllers/LiveTvController.cs b/Jellyfin.Api/Controllers/LiveTvController.cs index 074cdb24e0..113298c251 100644 --- a/Jellyfin.Api/Controllers/LiveTvController.cs +++ b/Jellyfin.Api/Controllers/LiveTvController.cs @@ -744,10 +744,12 @@ public class LiveTvController : BaseJellyfinApiController /// Program id. /// Optional. Attach user data. /// Program returned. + /// Program not found. /// An containing the livetv program. [HttpGet("Programs/{programId}")] [Authorize(Policy = Policies.LiveTvAccess)] [ProducesResponseType(StatusCodes.Status200OK)] + [ProducesResponseType(StatusCodes.Status404NotFound)] public async Task> GetProgram( [FromRoute, Required] string programId, [FromQuery] Guid? userId) @@ -756,8 +758,14 @@ public class LiveTvController : BaseJellyfinApiController var user = userId.IsNullOrEmpty() ? null : _userManager.GetUserById(userId.Value); + var result = await _liveTvManager.GetProgram(programId, CancellationToken.None, user).ConfigureAwait(false); + + if (result is null) + { + return NotFound(); + } - return await _liveTvManager.GetProgram(programId, CancellationToken.None, user).ConfigureAwait(false); + return Ok(result); } /// -- cgit v1.2.3