mirror of
https://github.com/C9Glax/tranga.git
synced 2025-05-22 14:13:01 +02:00
MangaDex fix crash if "en" tag was missing
This commit is contained in:
parent
703e32a30e
commit
63442e9af6
@ -228,8 +228,8 @@ public class MangaDex : MangaConnector
|
|||||||
string? id = jToken.Value<string>("id");
|
string? id = jToken.Value<string>("id");
|
||||||
|
|
||||||
JObject? attributes = jToken["attributes"] as JObject;
|
JObject? attributes = jToken["attributes"] as JObject;
|
||||||
string? name = attributes?["title"]?.Value<string>("en");
|
string? name = attributes?["title"]?.Value<string>("en")??attributes?["title"]?.First?.Value<string>();
|
||||||
string? description = attributes?["description"]?.Value<string>("en");
|
string? description = attributes?["description"]?.Value<string>("en")??attributes?["description"]?.First?.Value<string>();
|
||||||
string? status = attributes?["status"]?.Value<string>();
|
string? status = attributes?["status"]?.Value<string>();
|
||||||
uint? year = attributes?["year"]?.Value<uint>();
|
uint? year = attributes?["year"]?.Value<uint>();
|
||||||
string? originalLanguage = attributes?["originalLanguage"]?.Value<string>();
|
string? originalLanguage = attributes?["originalLanguage"]?.Value<string>();
|
||||||
@ -288,7 +288,7 @@ public class MangaDex : MangaConnector
|
|||||||
|
|
||||||
List<MangaTag> tags = tagsJArray
|
List<MangaTag> tags = tagsJArray
|
||||||
.Where(t => t.Value<string>("type") == "tag")
|
.Where(t => t.Value<string>("type") == "tag")
|
||||||
.Select(t => t["attributes"]?["name"]?.Value<string>("en"))
|
.Select(t => t["attributes"]?["name"]?.Value<string>("en")??t["attributes"]?["name"]?.First?.Value<string>())
|
||||||
.Select(str => str is not null ? new MangaTag(str) : null)
|
.Select(str => str is not null ? new MangaTag(str) : null)
|
||||||
.Where(x => x is not null).ToList()!;
|
.Where(x => x is not null).ToList()!;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user