From 19ac5523ca1b6b553288a6986217b8eabb8cea40 Mon Sep 17 00:00:00 2001 From: Xwilarg Date: Fri, 15 Nov 2024 13:52:21 +0100 Subject: [PATCH] Add catch on AV tags --- Sanara/Module/Command/Impl/Doujin.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Sanara/Module/Command/Impl/Doujin.cs b/Sanara/Module/Command/Impl/Doujin.cs index 667ee2e..a52f9a5 100644 --- a/Sanara/Module/Command/Impl/Doujin.cs +++ b/Sanara/Module/Command/Impl/Doujin.cs @@ -189,7 +189,16 @@ public async Task AdultVideoAsync(IContext ctx) // Get fields var name = html.DocumentNode.SelectSingleNode("//h1[contains(@class, 'lg:text-lg')]").InnerHtml; var description = HttpUtility.HtmlDecode(info.ChildNodes[1].ChildNodes[1].ChildNodes[1].InnerHtml); - var tags = info.ChildNodes[1].ChildNodes[5].ChildNodes[7].SelectNodes("a").Select(x => x.InnerHtml); + IEnumerable tags; + try + { + tags = info.ChildNodes[1].ChildNodes[5].ChildNodes[7].SelectNodes("a").Select(x => x.InnerHtml); + } + catch (System.Exception e) + { + tags = []; + await Log.LogErrorAsync(e, null); + } if (name.Length > 256) name = name[..255] + "…"; var embed = new EmbedBuilder()