MDL-29400 Fixing unset object bug encountered by Rajesh during testing
authorGerard (Gerry) Caulfield <gerry@moodle.com>
Thu, 22 Dec 2011 06:00:44 +0000 (14:00 +0800)
committerGerard (Gerry) Caulfield <gerry@moodle.com>
Thu, 22 Dec 2011 06:00:44 +0000 (14:00 +0800)
mod/assignment/type/upload/assignment.class.php
mod/assignment/type/uploadsingle/assignment.class.php

index 5c993f9..44d10c9 100644 (file)
@@ -1052,7 +1052,7 @@ class assignment_upload extends assignment_base {
         }
 
         // If the user has submitted something add some related links and data
-        if ($submission->data2 == 'submitted') {
+        if (isset($submission->data2) AND $submission->data2 == 'submitted') {
             // Add a view link to the settings nav
             $link = new moodle_url('/mod/assignment/view.php', array('id'=>$this->cm->id));
             $node->add(get_string('viewmysubmission', 'assignment'), $link, navigation_node::TYPE_SETTING);
index 73ad517..03f91af 100644 (file)
@@ -319,7 +319,7 @@ class assignment_uploadsingle extends assignment_base {
         }
 
         // If the user has submitted something add some related links and data
-        if ($submission->numfiles) {
+        if (isset($submission->numfiles) AND $submission->numfiles) {
             // Add a view link to the settings nav
             $link = new moodle_url('/mod/assignment/view.php', array('id'=>$this->cm->id));
             $node->add(get_string('viewmysubmission', 'assignment'), $link, navigation_node::TYPE_SETTING);