MangaKatana fix bug where empty result in search would crash program

This commit is contained in:
glax 2023-07-31 23:03:46 +02:00
parent 436edfde66
commit 81d5802092

View File

@ -48,6 +48,8 @@ public class MangaKatana : Connector
HtmlDocument document = new(); HtmlDocument document = new();
document.LoadHtml(htmlString); document.LoadHtml(htmlString);
IEnumerable<HtmlNode> searchResults = document.DocumentNode.SelectNodes("//*[@id='book_list']/div"); IEnumerable<HtmlNode> searchResults = document.DocumentNode.SelectNodes("//*[@id='book_list']/div");
if (searchResults is null || !searchResults.Any())
return Array.Empty<Publication>();
List<string> urls = new(); List<string> urls = new();
foreach (HtmlNode mangaResult in searchResults) foreach (HtmlNode mangaResult in searchResults)
{ {