Skip to content

Commit

Permalink
fix: handle null values in array_reverse call
Browse files Browse the repository at this point in the history
  • Loading branch information
rajandangi committed Oct 24, 2024
1 parent 95c7dcf commit 6eeef26
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -371,9 +371,10 @@ protected function load_definition() {
$options = $this->get_options();
if (!$options['sortlevelsasc']) {
if ($this->definition) {
foreach (array_keys($this->definition->rubric_criteria) as $rcid) {
$this->definition->rubric_criteria[$rcid]['levels'] =
array_reverse($this->definition->rubric_criteria[$rcid]['levels'], true);
foreach ($this->definition->rubric_criteria as $rcid => $criteria) {
if (!empty($criteria['levels']) && is_array($criteria['levels'])) {
$this->definition->rubric_criteria[$rcid]['levels'] = array_reverse($criteria['levels'], true);
}
}
}
}
Expand Down

0 comments on commit 6eeef26

Please sign in to comment.