Fix #87, manga that return no chapters, crash when updating latest released chapter.
This commit is contained in:
Glax 2023-12-24 16:43:49 +01:00
parent b4f97eefcf
commit 800d4c1ec1

View File

@ -59,6 +59,9 @@ public abstract class MangaConnector : GlobalBase
{ {
Log($"Getting new Chapters for {manga}"); Log($"Getting new Chapters for {manga}");
Chapter[] allChapters = this.GetChapters(manga, language); Chapter[] allChapters = this.GetChapters(manga, language);
if (allChapters.Length < 1)
return Array.Empty<Chapter>();
Log($"Checking for duplicates {manga}"); Log($"Checking for duplicates {manga}");
List<Chapter> newChaptersList = allChapters.Where(nChapter => float.TryParse(nChapter.chapterNumber, numberFormatDecimalPoint, out float chapterNumber) List<Chapter> newChaptersList = allChapters.Where(nChapter => float.TryParse(nChapter.chapterNumber, numberFormatDecimalPoint, out float chapterNumber)
&& chapterNumber > manga.ignoreChaptersBelow && chapterNumber > manga.ignoreChaptersBelow
@ -71,11 +74,10 @@ public abstract class MangaConnector : GlobalBase
manga.latestChapterAvailable = manga.latestChapterAvailable =
Convert.ToSingle(latestChapterAvailable.chapterNumber, numberFormatDecimalPoint); Convert.ToSingle(latestChapterAvailable.chapterNumber, numberFormatDecimalPoint);
} }
catch (FormatException f) catch (Exception e)
{ {
Log(f.ToString()); Log(e.ToString());
Log($"Failed getting new Chapters for {manga}"); Log($"Failed getting new Chapters for {manga}");
return Array.Empty<Chapter>();
} }
return newChaptersList.ToArray(); return newChaptersList.ToArray();