diff --git a/Tranga/MangaConnectors/MangaDex.cs b/Tranga/MangaConnectors/MangaDex.cs index a50e445..3b097c4 100644 --- a/Tranga/MangaConnectors/MangaDex.cs +++ b/Tranga/MangaConnectors/MangaDex.cs @@ -111,7 +111,7 @@ public class MangaDex : MangaConnector string description = descriptionNode!.AsObject().ContainsKey("en") switch { true => descriptionNode.AsObject()["en"]!.GetValue(), - false => descriptionNode.AsObject().First().Value!.GetValue() + false => descriptionNode.AsObject().FirstOrDefault().Value?.GetValue() ?? "" }; Dictionary linksDict = new(); @@ -122,14 +122,14 @@ public class MangaDex : MangaConnector string? originalLanguage = attributes.TryGetPropertyValue("originalLanguage", out JsonNode? originalLanguageNode) switch { - true => originalLanguageNode!.GetValue(), + true => originalLanguageNode?.GetValue(), false => null }; Manga.ReleaseStatusByte status = Manga.ReleaseStatusByte.Unreleased; if (attributes.TryGetPropertyValue("status", out JsonNode? statusNode)) { - status = statusNode!.GetValue().ToLower() switch + status = statusNode?.GetValue().ToLower() switch { "ongoing" => Manga.ReleaseStatusByte.Continuing, "completed" => Manga.ReleaseStatusByte.Completed, @@ -141,7 +141,7 @@ public class MangaDex : MangaConnector int? year = attributes.TryGetPropertyValue("year", out JsonNode? yearNode) switch { - true => yearNode!.GetValue(), + true => yearNode?.GetValue(), false => null };