소스 검색

Minor - fix php warning

jmontoyaa 8 년 전
부모
커밋
ff92969724
1개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 6 2
      main/exercise/exercise.class.php

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

@@ -8199,8 +8199,12 @@ class Exercise
             $numberRandomQuestions = $this->random;
             $numberRandomQuestions = $this->random;
             $questionScoreList = array();
             $questionScoreList = array();
             for ($i = 1; $i <= count($questionList); $i++) {
             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);
             rsort($questionScoreList);
             // add the first $numberRandomQuestions value of score array to get max_score
             // add the first $numberRandomQuestions value of score array to get max_score