Skip to content

Commit

Permalink
Merge pull request #55 from andil-elearning/master_missing_context
Browse files Browse the repository at this point in the history
Prevent export crash due to missing user context
  • Loading branch information
bostelm authored Jul 25, 2024
2 parents ec4aec8 + 89dc953 commit 858153b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion exportlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,8 @@ public function get_header(scheduler $scheduler) {
* @return string the value of this field for the given data
*/
public function get_value(slot $slot, $appointment) {
if (!$appointment instanceof appointment || $appointment->studentid == 0) {
if (!$appointment instanceof appointment || $appointment->studentid == 0
|| !context_user::instance($appointment->studentid, IGNORE_MISSING)) {
return '';
}
$this->field->set_userid($appointment->studentid);
Expand Down

0 comments on commit 858153b

Please sign in to comment.