Prevent crashing JS.
parent
e1ce82fcf4
commit
439f850729
|
@ -143,7 +143,8 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
answered = answered && (questionInstances[i]).getAnswerGiven();
|
||||
}
|
||||
|
||||
if (currentQuestion === (params.questions.length - 1) && answered) {
|
||||
if (currentQuestion === (params.questions.length - 1) && answered &&
|
||||
questionInstances[currentQuestion]) {
|
||||
questionInstances[currentQuestion].showButton('finish');
|
||||
}
|
||||
};
|
||||
|
@ -160,11 +161,13 @@ H5P.QuestionSet = function (options, contentId) {
|
|||
// Hide all questions
|
||||
$('.question-container', $myDom).hide().eq(questionNumber).show();
|
||||
|
||||
if (questionInstances[questionNumber]) {
|
||||
// Trigger resize on question in case the size of the QS has changed.
|
||||
var instance = questionInstances[questionNumber];
|
||||
if (instance.$ !== undefined) {
|
||||
instance.trigger('resize');
|
||||
}
|
||||
}
|
||||
|
||||
// Update progress indicator
|
||||
// Test if current has been answered.
|
||||
|
|
Loading…
Reference in New Issue