Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

gradebook MDL-19070 Added a guard to protect against a potential error

  • Loading branch information...
commit 9cb5d53238595922855ee7585d86e83cd5e676af 1 parent 6c71cb9
Andrew Davis authored

Showing 1 changed file with 6 additions and 1 deletion. Show diff stats Hide diff stats

  1. +6 1 grade/edit/tree/lib.php
7 grade/edit/tree/lib.php
@@ -664,7 +664,12 @@ function get_item_cell($item, $params) {
664 664 $grademax = format_float($item->grademax, $item->get_decimals());
665 665 } elseif ($item->gradetype == GRADE_TYPE_SCALE) {
666 666 $scale = get_record('scale', 'id', $item->scaleid);
667   - $scale_items = explode(',', $scale->scale);
  667 + $scale_items = null;
  668 + if (empty($scale)) { //if the item is using a scale that's been removed
  669 + $scale_items = array();
  670 + } else {
  671 + $scale_items = explode(',', $scale->scale);
  672 + }
668 673 $grademax = end($scale_items) . ' (' . count($scale_items) . ')';
669 674 } elseif ($item->is_external_item()) {
670 675 $grademax = format_float($item->grademax, $item->get_decimals());

0 comments on commit 9cb5d53

Please sign in to comment.
Something went wrong with that request. Please try again.