From 0dfab8f2279784b3c7b7ee5fde68724f21a51185 Mon Sep 17 00:00:00 2001 From: Simon Katan Date: Tue, 23 Apr 2024 12:24:48 +0100 Subject: [PATCH] fix: to prevent undefined error --- src/components/PupilComponents/QuizRenderer/QuizRenderer.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/PupilComponents/QuizRenderer/QuizRenderer.tsx b/src/components/PupilComponents/QuizRenderer/QuizRenderer.tsx index eeb24e76d5..b4cad50aa8 100644 --- a/src/components/PupilComponents/QuizRenderer/QuizRenderer.tsx +++ b/src/components/PupilComponents/QuizRenderer/QuizRenderer.tsx @@ -68,6 +68,7 @@ export const QuizRenderer = (props: QuizRenderProps) => { } for (const entries of formData.entries()) { + if (!entries[1]) continue; // if there is no index for the answer skip it const i = Number((entries[1] as string).at(-1)); // assumes the last character is the index and no more than 10 answers const a = answers?.["multiple-choice"]?.[i]; a && selectedAnswers.push(a);