Fixed undefined answers in previous state.

HFP-9
pull/7/head
thomasmars 2016-10-03 13:19:25 +02:00
parent 601ae585e1
commit 84c8751238
1 changed files with 2 additions and 1 deletions

View File

@ -165,9 +165,10 @@ H5P.QuestionSet = function (options, contentId, contentData) {
question.params.overrideSettings = question.params.overrideSettings || {}; question.params.overrideSettings = question.params.overrideSettings || {};
question.params.overrideSettings.$confirmationDialogParent = $template.last(); question.params.overrideSettings.$confirmationDialogParent = $template.last();
question.params.overrideSettings.instance = this; question.params.overrideSettings.instance = this;
var hasAnswers = contentData.previousState && contentData.previousState.answers;
var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, 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 parent: self
}); });
questionInstance.on('resize', function () { questionInstance.on('resize', function () {