Add safety check

pull/4/head^2
Timothy Lim 2016-10-20 08:18:43 +02:00
parent 453addfa47
commit 06060af419
1 changed files with 9 additions and 1 deletions

View File

@ -212,7 +212,15 @@ H5P.QuestionSet = function (options, contentId, contentData) {
// Retrieve questions and indexes // Retrieve questions and indexes
questions = questionOrdering.map(d => d[0]); questions = questionOrdering.map(d => d[0]);
var newOrder = questionOrdering.map(d => questionOrder[d[1]])
// Use the previous question order if it exists
var newOrder;
if (questionOrder) {
newOrder = questionOrdering.map(d => questionOrder[d[1]]);
}
else{
newOrder = questionOrdering.map(d => d[1]);
}
return { return {
questions:questions, questions:questions,