Skip to content

Commit 825b945

Browse files
committed
AsuraToon Crash on no Artists or Authors
Fix #296
1 parent b8c624f commit 825b945

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Tranga/MangaConnectors/AsuraToon.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,13 @@ private Manga ParseSinglePublicationFromHtml(HtmlDocument document, string publi
102102

103103
HtmlNode descriptionNode =
104104
document.DocumentNode.SelectSingleNode("//h3[starts-with(text(),'Synopsis')]/../span");
105-
string description = descriptionNode.InnerText;
105+
string description = descriptionNode?.InnerText??"";
106106

107107
HtmlNodeCollection authorNodes = document.DocumentNode.SelectNodes("//h3[text()='Author']/../h3[not(text()='Author' or text()='_')]");
108-
HtmlNodeCollection artistNodes = document.DocumentNode.SelectNodes("//h3[text()='Artist']/../h3[not(text()='Author' or text()='_')]");
109-
List<string> authors = authorNodes.Select(a => a.InnerText).Concat(artistNodes.Select(a => a.InnerText)).ToList();
108+
HtmlNodeCollection artistNodes = document.DocumentNode.SelectNodes("//h3[text()='Artist']/../h3[not(text()='Artist' or text()='_')]");
109+
IEnumerable<string> authorNames = authorNodes is null ? [] : authorNodes.Select(a => a.InnerText);
110+
IEnumerable<string> artistNames = artistNodes is null ? [] : artistNodes.Select(a => a.InnerText);
111+
List<string> authors = authorNames.Concat(artistNames).ToList();
110112

111113
HtmlNode? firstChapterNode = document.DocumentNode.SelectSingleNode("//a[contains(@href, 'chapter/1')]/../following-sibling::h3");
112114
int? year = int.Parse(firstChapterNode?.InnerText.Split(' ')[^1] ?? "2000");

0 commit comments

Comments
 (0)