MDL-57757 mod_lesson: Check that there is an object
authorDavid Monllao <david.monllao@gmail.com>
Wed, 29 Mar 2017 10:56:33 +0000 (12:56 +0200)
committerDavid Monllao <david.monllao@gmail.com>
Wed, 29 Mar 2017 10:56:33 +0000 (12:56 +0200)
mod/lesson/report.php

index 4e72e11..7e95ae2 100644 (file)
@@ -327,7 +327,7 @@ if ($action === 'delete') {
         $table->data[] = array($fontstart.get_string("question", "lesson").": <br />".$fontend.$fontstart2.$page->contents.$fontend2, " ");
         $table->data[] = array($fontstart.get_string("answer", "lesson").":".$fontend, ' ');
         // apply the font to each answer
-        if (!empty($page->answerdata->answers)) {
+        if (!empty($page->answerdata) && !empty($page->answerdata->answers)) {
             foreach ($page->answerdata->answers as $answer){
                 $modified = array();
                 foreach ($answer as $single) {