Skip to content

Commit

Permalink
MDL-35158 - Random Glossary block returns an error when you delete th…
Browse files Browse the repository at this point in the history
…e linked glossary
  • Loading branch information
grabs committed Nov 17, 2012
1 parent 2d7c5ee commit 95a6ed7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions blocks/glossary_random/block_glossary_random.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,6 @@ function get_content() {
$course = $this->page->course;
$modinfo = get_fast_modinfo($course);
$glossaryid = $this->config->glossary;
$cm = $modinfo->instances['glossary'][$glossaryid];

if (!has_capability('mod/glossary:view', context_module::instance($cm->id))) {
return '';
}

if (!isset($modinfo->instances['glossary'][$glossaryid])) {
// we can get here if the glossary has been deleted, so
Expand All @@ -147,6 +142,12 @@ function get_content() {
return $this->content;
}

$cm = $modinfo->instances['glossary'][$glossaryid];

if (!has_capability('mod/glossary:view', context_module::instance($cm->id))) {
return '';
}

if (empty($this->config->cache)) {
$this->config->cache = '';
}
Expand Down

0 comments on commit 95a6ed7

Please sign in to comment.