From 84c8751238f8ef0fae51a1796a2a9b7f3e9633a9 Mon Sep 17 00:00:00 2001 From: thomasmars Date: Mon, 3 Oct 2016 13:19:25 +0200 Subject: [PATCH] Fixed undefined answers in previous state. HFP-9 --- js/questionset.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 634a296..3602de9 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -165,9 +165,10 @@ H5P.QuestionSet = function (options, contentId, contentData) { question.params.overrideSettings = question.params.overrideSettings || {}; question.params.overrideSettings.$confirmationDialogParent = $template.last(); question.params.overrideSettings.instance = this; + var hasAnswers = contentData.previousState && contentData.previousState.answers; var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, { - previousState: contentData.previousState ? contentData.previousState.answers[i] : undefined, + previousState: hasAnswers ? contentData.previousState.answers[i] : undefined, parent: self }); questionInstance.on('resize', function () {