From 65b34e2fb00fec43428886e835cf6bc64266bcdc Mon Sep 17 00:00:00 2001 From: Tom Robiquet Date: Thu, 21 Mar 2024 12:09:54 +0000 Subject: [PATCH] null check --- pages/api/og/generate.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/api/og/generate.tsx b/pages/api/og/generate.tsx index 4aea209da..cdcb9e3bf 100644 --- a/pages/api/og/generate.tsx +++ b/pages/api/og/generate.tsx @@ -37,8 +37,8 @@ export default async function GenerateOgImage(request: NextRequest) { }: MarketImageData = await fetch(marketUrl.href).then((r) => r.json()); const cmsRes = await fetch(cmsUrl).then((r) => r.json()); - const cmsImageUrl = cmsRes[0]?.imageUrl; - const cmsQuestion = cmsRes[0]?.question; + const cmsImageUrl = cmsRes?.[0]?.imageUrl; + const cmsQuestion = cmsRes?.[0]?.question; const fallbackImagePath = `${urlBase}${getFallbackImage( market.tags,