Skip to content
Browse files

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

  • Loading branch information...
1 parent 6c71cb9 commit 9cb5d53238595922855ee7585d86e83cd5e676af Andrew Davis committed Aug 11, 2010
Showing with 6 additions and 1 deletion.
  1. +6 −1 grade/edit/tree/lib.php
View
7 grade/edit/tree/lib.php
@@ -664,7 +664,12 @@ function get_item_cell($item, $params) {
$grademax = format_float($item->grademax, $item->get_decimals());
} elseif ($item->gradetype == GRADE_TYPE_SCALE) {
$scale = get_record('scale', 'id', $item->scaleid);
- $scale_items = explode(',', $scale->scale);
+ $scale_items = null;
+ if (empty($scale)) { //if the item is using a scale that's been removed
+ $scale_items = array();
+ } else {
+ $scale_items = explode(',', $scale->scale);
+ }
$grademax = end($scale_items) . ' (' . count($scale_items) . ')';
} elseif ($item->is_external_item()) {
$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.