From 06060af419ad58e7f0263f895f87456d62c03ddf Mon Sep 17 00:00:00 2001 From: Timothy Lim Date: Thu, 20 Oct 2016 08:18:43 +0200 Subject: [PATCH] Add safety check --- js/questionset.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 7aa037b..ac75666 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -212,7 +212,15 @@ H5P.QuestionSet = function (options, contentId, contentData) { // Retrieve questions and indexes 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 { questions:questions,