Create use effect command #419
1 changed files with 2 additions and 0 deletions
|
@ -97,6 +97,8 @@ export default class CardDropHelperMetadata {
|
||||||
.filter(x => x.type == rarity)
|
.filter(x => x.type == rarity)
|
||||||
.filter(x => !claimedCards.find(y => y.CardNumber == x.id));
|
.filter(x => !claimedCards.find(y => y.CardNumber == x.id));
|
||||||
|
|
||||||
|
if (!allCards) return undefined;
|
||||||
|
|
||||||
const randomCardIndex = Math.floor(Math.random() * allCards.length);
|
const randomCardIndex = Math.floor(Math.random() * allCards.length);
|
||||||
Vylpes marked this conversation as resolved
Outdated
|
|||||||
|
|
||||||
const card = allCards[randomCardIndex];
|
const card = allCards[randomCardIndex];
|
||||||
|
|
Loading…
Reference in a new issue
The variable 'card' can be undefined if 'allCards' is empty. Add a check to ensure 'allCards' is not empty before accessing an element by index.