From 63442e9af6a6767a92888ef580312a42c2effcdd Mon Sep 17 00:00:00 2001 From: Glax Date: Sat, 17 May 2025 22:51:57 +0200 Subject: [PATCH] MangaDex fix crash if "en" tag was missing --- API/Schema/MangaConnectors/MangaDex.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/API/Schema/MangaConnectors/MangaDex.cs b/API/Schema/MangaConnectors/MangaDex.cs index 4557007..6c46efb 100644 --- a/API/Schema/MangaConnectors/MangaDex.cs +++ b/API/Schema/MangaConnectors/MangaDex.cs @@ -228,8 +228,8 @@ public class MangaDex : MangaConnector string? id = jToken.Value("id"); JObject? attributes = jToken["attributes"] as JObject; - string? name = attributes?["title"]?.Value("en"); - string? description = attributes?["description"]?.Value("en"); + string? name = attributes?["title"]?.Value("en")??attributes?["title"]?.First?.Value(); + string? description = attributes?["description"]?.Value("en")??attributes?["description"]?.First?.Value(); string? status = attributes?["status"]?.Value(); uint? year = attributes?["year"]?.Value(); string? originalLanguage = attributes?["originalLanguage"]?.Value(); @@ -288,7 +288,7 @@ public class MangaDex : MangaConnector List tags = tagsJArray .Where(t => t.Value("type") == "tag") - .Select(t => t["attributes"]?["name"]?.Value("en")) + .Select(t => t["attributes"]?["name"]?.Value("en")??t["attributes"]?["name"]?.First?.Value()) .Select(str => str is not null ? new MangaTag(str) : null) .Where(x => x is not null).ToList()!;