fix: return if remap is null

This commit is contained in:
Jozef Steinhübl 2024-05-21 06:40:29 +02:00
parent e5bcf61676
commit dbf7fcdd87
No known key found for this signature in database
GPG key ID: E6BC90C91973B08F
2 changed files with 3 additions and 1 deletions

View file

@ -124,6 +124,7 @@ async function handleBunReportLink(message: Message): Promise<void> {
if (!match?.[0]) return;
const data = await getBunReportDetailsInMarkdown(match[0]);
if (!data) return;
// @ts-expect-error allowed_mentions
message.reply({

View file

@ -52,8 +52,9 @@ export function sliceIfStartsWith(input: string, startsWith: string) {
export async function getBunReportDetailsInMarkdown(
url: string
): Promise<string> {
): Promise<string | undefined> {
const remap = await parseAndRemap(url);
if (!remap) return;
if (!Array.isArray(remap.features)) remap.features = []; // temporary fix
let content = formatMarkdown(remap, {