Skip to content

Commit

Permalink
Amend 29f6de2
Browse files Browse the repository at this point in the history
Fix #87, manga that return no chapters, crash when updating latest released chapter.
  • Loading branch information
C9Glax committed Dec 24, 2023
1 parent b4f97ee commit 800d4c1
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Tranga/MangaConnectors/MangaConnector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ public Chapter[] GetNewChapters(Manga manga, string language = "en")
{
Log($"Getting new Chapters for {manga}");
Chapter[] allChapters = this.GetChapters(manga, language);
if (allChapters.Length < 1)
return Array.Empty<Chapter>();

Log($"Checking for duplicates {manga}");
List<Chapter> newChaptersList = allChapters.Where(nChapter => float.TryParse(nChapter.chapterNumber, numberFormatDecimalPoint, out float chapterNumber)
&& chapterNumber > manga.ignoreChaptersBelow
Expand All @@ -71,11 +74,10 @@ public Chapter[] GetNewChapters(Manga manga, string language = "en")
manga.latestChapterAvailable =
Convert.ToSingle(latestChapterAvailable.chapterNumber, numberFormatDecimalPoint);
}
catch (FormatException f)
catch (Exception e)
{
Log(f.ToString());
Log(e.ToString());
Log($"Failed getting new Chapters for {manga}");
return Array.Empty<Chapter>();
}

return newChaptersList.ToArray();
Expand Down

0 comments on commit 800d4c1

Please sign in to comment.