]> git.mjollnir.org Git - moodle.git/commitdiff
NOBUG Fixed error happening when restoring missingtype questions if answers weren...
authorstronk7 <stronk7>
Wed, 29 Jul 2009 19:00:55 +0000 (19:00 +0000)
committerstronk7 <stronk7>
Wed, 29 Jul 2009 19:00:55 +0000 (19:00 +0000)
question/type/missingtype/edit_missingtype_form.php

index 02e8c9a3dbfcbbcf15074d2e5c91746439755c75..7e1583f5801c5f93720d8874d9de8a9b25770d4e 100644 (file)
@@ -27,7 +27,8 @@ class question_edit_missingtype_form extends question_edit_form {
     function set_data($question) {
         if (isset($question->options)){
             $answers = $question->options->answers;
-            if (count($answers)) {
+            $default_values = array();
+            if (is_array($answers) && count($answers)) {
                 $key = 0;
                 foreach ($answers as $answer){
                     $default_values['answer['.$key.']'] = $answer->answer;
@@ -84,4 +85,4 @@ class question_edit_missingtype_form extends question_edit_form {
         return $errors;
     }
 }
-?>
\ No newline at end of file
+?>