From 1a861d244b0d365447f9a8b4e9e565b88bf99ff5 Mon Sep 17 00:00:00 2001 From: stronk7 Date: Wed, 29 Jul 2009 19:00:55 +0000 Subject: [PATCH] NOBUG Fixed error happening when restoring missingtype questions if answers weren't present (cast error) Merged from 19_STABLE --- question/type/missingtype/edit_missingtype_form.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/question/type/missingtype/edit_missingtype_form.php b/question/type/missingtype/edit_missingtype_form.php index 02e8c9a3db..7e1583f580 100644 --- a/question/type/missingtype/edit_missingtype_form.php +++ b/question/type/missingtype/edit_missingtype_form.php @@ -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 +?> -- 2.39.5