Skip to content

Commit

Permalink
fix: error on game
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandru Mihoc committed Sep 30, 2023
1 parent c030dad commit 4ab65a6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/screens/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ const Game = () => {
const indexOfAnswer = (index: number) => {
if (currentQuestion === undefined) return;
if (
currentQuestion.answers[index].answer === '' ||
currentQuestion.answers[index].answer === undefined
currentQuestion?.answers[index]?.answer === undefined ||
currentQuestion?.answers[index]?.answer === ''
) {
return '';
}
Expand All @@ -94,8 +94,8 @@ const Game = () => {
(answerEntry: number) => answerEntry === index
);
if (answerRevealed !== undefined) {
return `${currentQuestion.answers[index].answer} - ${currentQuestion.answers[index].points}`;
} else if (index < currentQuestion.answers.length) {
return `${currentQuestion?.answers[index]?.answer} - ${currentQuestion?.answers[index]?.points}`;
} else if (index < currentQuestion?.answers?.length) {
return `${index + 1}`;
}
}
Expand Down

0 comments on commit 4ab65a6

Please sign in to comment.