From 0092d91ee6c6ae42ebcb74fc6fe5b3f3990112db Mon Sep 17 00:00:00 2001 From: Ethan Lane Date: Fri, 3 Jan 2025 14:41:08 +0000 Subject: [PATCH] Fix undefined error if allCards variable is null --- src/helpers/CardDropHelperMetadata.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/helpers/CardDropHelperMetadata.ts b/src/helpers/CardDropHelperMetadata.ts index 80f3d6b..8ca9e51 100644 --- a/src/helpers/CardDropHelperMetadata.ts +++ b/src/helpers/CardDropHelperMetadata.ts @@ -97,6 +97,8 @@ export default class CardDropHelperMetadata { .filter(x => x.type == rarity) .filter(x => !claimedCards.find(y => y.CardNumber == x.id)); + if (!allCards) return undefined; + const randomCardIndex = Math.floor(Math.random() * allCards.length); const card = allCards[randomCardIndex];