#67 prevent crash if xml document does not exist
This commit is contained in:
parent
fd9319de27
commit
6844d0a242
@ -121,6 +121,8 @@ public class Mangasee : MangaConnector
|
||||
public override Chapter[] GetChapters(Manga manga, string language="en")
|
||||
{
|
||||
Log($"Getting chapters {manga}");
|
||||
try
|
||||
{
|
||||
XDocument doc = XDocument.Load($"https://mangasee123.com/rss/{manga.publicationId}.xml");
|
||||
XElement[] chapterItems = doc.Descendants("item").ToArray();
|
||||
List<Chapter> chapters = new();
|
||||
@ -138,6 +140,12 @@ public class Mangasee : MangaConnector
|
||||
Log($"Got {chapters.Count} chapters. {manga}");
|
||||
return chapters.OrderBy(chapter => Convert.ToSingle(chapter.chapterNumber, numberFormatDecimalPoint)).ToArray();
|
||||
}
|
||||
catch (HttpRequestException e)
|
||||
{
|
||||
Log($"Failed to load XML\n\r{e}");
|
||||
return Array.Empty<Chapter>();
|
||||
}
|
||||
}
|
||||
|
||||
public override HttpStatusCode DownloadChapter(Chapter chapter, ProgressToken? progressToken = null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user