From 20678c9a8c178657881565b7d4147896b604aa60 Mon Sep 17 00:00:00 2001 From: zerafachris Date: Tue, 1 Sep 2026 16:25:59 +0200 Subject: [PATCH] fix: return fallback gracefully when requested fallback font is missing GetFallbackFont() called .First() on the font file sequence, which throws System.InvalidOperationException when no file matched the requested name, causing HTTP 500. Change to .FirstOrDefault() so a missing font falls through to the existing null guard and returns HTTP 200 OK (the empty response is intentional to avoid breaking SubtitlesOctopus). Fixes #17683. Prepared with AI assistance (Claude Code, Anthropic), reviewed for correctness before submission. Co-Authored-By: Claude Sonnet 4.6 --- Jellyfin.Api/Controllers/SubtitleController.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jellyfin.Api/Controllers/SubtitleController.cs b/Jellyfin.Api/Controllers/SubtitleController.cs index e5df873f5b..c4851091c1 100644 --- a/Jellyfin.Api/Controllers/SubtitleController.cs +++ b/Jellyfin.Api/Controllers/SubtitleController.cs @@ -557,7 +557,7 @@ public class SubtitleController : BaseJellyfinApiController if (!string.IsNullOrEmpty(fallbackFontPath)) { var fontFile = _fileSystem.GetFiles(fallbackFontPath) - .First(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase)); + .FirstOrDefault(i => string.Equals(i.Name, name, StringComparison.OrdinalIgnoreCase)); var fileSize = fontFile?.Length; if (fontFile is not null && fileSize is not null && fileSize > 0)