aboutsummaryrefslogtreecommitdiff
path: root/Jellyfin.Api/Controllers
diff options
context:
space:
mode:
authorBruno Ferreira <brunoferreiradevv@gmail.com>2026-05-17 09:01:39 -0300
committerGitHub <noreply@github.com>2026-05-17 14:01:39 +0200
commit2f8bf92fb80c8bf8568e8b22aba31a839b8862d3 (patch)
tree68ab86e38a1847b642c3c0e7f746dc33cb0d98f5 /Jellyfin.Api/Controllers
parented3c62b66ed8968b643e7d20ebcc2b21f3ca5f95 (diff)
fix: add null check for non-existent program in GetProgram (#16858)
fix: add null check for non-existent program in GetProgram
Diffstat (limited to 'Jellyfin.Api/Controllers')
-rw-r--r--Jellyfin.Api/Controllers/LiveTvController.cs10
1 files changed, 9 insertions, 1 deletions
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
/// <param name="programId">Program id.</param>
/// <param name="userId">Optional. Attach user data.</param>
/// <response code="200">Program returned.</response>
+ /// <response code="404">Program not found.</response>
/// <returns>An <see cref="OkResult"/> containing the livetv program.</returns>
[HttpGet("Programs/{programId}")]
[Authorize(Policy = Policies.LiveTvAccess)]
[ProducesResponseType(StatusCodes.Status200OK)]
+ [ProducesResponseType(StatusCodes.Status404NotFound)]
public async Task<ActionResult<BaseItemDto>> 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);
}
/// <summary>