From cc931028595d68b82d5dd42d287a91edab68d1f5 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 28 Sep 2025 01:03:31 +0300 Subject: [PATCH] fix(website): null error in download-helper --- apps/website/src/download-helper.ts | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/apps/website/src/download-helper.ts b/apps/website/src/download-helper.ts index 0a2c829e2..977a4c458 100644 --- a/apps/website/src/download-helper.ts +++ b/apps/website/src/download-helper.ts @@ -219,13 +219,18 @@ export function getRecommendedDownload(): RecommendedDownload | null { const platform = getPlatform(); if (!platform || !architecture) return null; - const downloadInfo = downloadMatrix.desktop[platform]?.downloads; + const platformInfo = downloadMatrix.desktop[platform]; + if (!platformInfo) return null; + + const downloadInfo = platformInfo.downloads; const recommendedDownload = Object.entries(downloadInfo || {}).find(d => d[1].recommended); - const format = recommendedDownload?.[0]; + if (!recommendedDownload) return null; + + const format = recommendedDownload[0]; const url = buildDownloadUrl("desktop", platform, format || 'zip', architecture); - const platformTitle = downloadMatrix.desktop[platform]?.title; - const name = typeof platformTitle === "string" ? platformTitle : platformTitle?.[architecture]; + const platformTitle = platformInfo.title; + const name = typeof platformTitle === "string" ? platformTitle : platformTitle[architecture] as string; return { architecture,