Skip to content

Commit

Permalink
MDL-68099 gradereport_grader: prevent exception without groups
Browse files Browse the repository at this point in the history
  • Loading branch information
marinaglancy committed May 18, 2020
1 parent d851183 commit ae02186
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions grade/report/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,9 @@ protected function setup_groups() {
$this->currentgroup = -2; // means can not access any groups at all
}
if ($this->currentgroup) {
$group = groups_get_group($this->currentgroup);
$this->currentgroupname = $group->name;
if ($group = groups_get_group($this->currentgroup)) {
$this->currentgroupname = $group->name;
}
$this->groupsql = " JOIN {groups_members} gm ON gm.userid = u.id ";
$this->groupwheresql = " AND gm.groupid = :gr_grpid ";
$this->groupwheresql_params = array('gr_grpid'=>$this->currentgroup);
Expand Down

0 comments on commit ae02186

Please sign in to comment.