Browse Source

Minor - fix php warning

jmontoyaa 8 years ago
parent
commit
ff92969724
1 changed files with 6 additions and 2 deletions
  1. 6 2
      main/exercise/exercise.class.php

+ 6 - 2
main/exercise/exercise.class.php

@@ -8199,8 +8199,12 @@ class Exercise
             $numberRandomQuestions = $this->random;
             $questionScoreList = array();
             for ($i = 1; $i <= count($questionList); $i++) {
-                $tmpobj_question = Question::read($questionList[$i]);
-                $questionScoreList[] = $tmpobj_question->weighting;
+                if (isset($questionList[$i])) {
+                    $tmpobj_question = Question::read($questionList[$i]);
+                    if (is_object($tmpobj_question)) {
+                        $questionScoreList[] = $tmpobj_question->weighting;
+                    }
+                }
             }
             rsort($questionScoreList);
             // add the first $numberRandomQuestions value of score array to get max_score