Skip to content

Commit

Permalink
Fix #281 Manganato errors when there is no chapters uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
C9Glax committed Nov 28, 2024
1 parent 5a8202f commit 204fb76
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Tranga/MangaConnectors/Manganato.cs
Original file line number Diff line number Diff line change
Expand Up @@ -130,13 +130,13 @@ private Manga ParseSinglePublicationFromHtml(HtmlDocument document, string publi

string pattern = "MMM dd,yyyy HH:mm";

HtmlNode oldestChapter = document.DocumentNode
HtmlNode? oldestChapter = document.DocumentNode
.SelectNodes("//span[contains(concat(' ',normalize-space(@class),' '),' chapter-time ')]").MaxBy(
node => DateTime.ParseExact(node.GetAttributeValue("title", "Dec 31 2400, 23:59"), pattern,
CultureInfo.InvariantCulture).Millisecond)!;
CultureInfo.InvariantCulture).Millisecond);


int year = DateTime.ParseExact(oldestChapter.GetAttributeValue("title", "Dec 31 2400, 23:59"), pattern,
int year = DateTime.ParseExact(oldestChapter?.GetAttributeValue("title", "Dec 31 2400, 23:59")??"Dec 31 2400, 23:59", pattern,
CultureInfo.InvariantCulture).Year;

Manga manga = new (sortName, authors.ToList(), description, altTitles, tags.ToArray(), posterUrl, coverFileNameInCache, links,
Expand Down

0 comments on commit 204fb76

Please sign in to comment.