From dbf7fcdd871a3e891f323bc740cf060e9864a0ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Tue, 21 May 2024 06:40:29 +0200 Subject: [PATCH] fix: return if remap is null --- src/listeners/message_create.tsx | 1 + src/util.ts | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/listeners/message_create.tsx b/src/listeners/message_create.tsx index 3562537..684b5fb 100644 --- a/src/listeners/message_create.tsx +++ b/src/listeners/message_create.tsx @@ -124,6 +124,7 @@ async function handleBunReportLink(message: Message): Promise { if (!match?.[0]) return; const data = await getBunReportDetailsInMarkdown(match[0]); + if (!data) return; // @ts-expect-error allowed_mentions message.reply({ diff --git a/src/util.ts b/src/util.ts index d57303c..5576dc1 100644 --- a/src/util.ts +++ b/src/util.ts @@ -52,8 +52,9 @@ export function sliceIfStartsWith(input: string, startsWith: string) { export async function getBunReportDetailsInMarkdown( url: string -): Promise { +): Promise { const remap = await parseAndRemap(url); + if (!remap) return; if (!Array.isArray(remap.features)) remap.features = []; // temporary fix let content = formatMarkdown(remap, {