Permalink
Browse files

MDL-35158 - Random Glossary block returns an error when you delete th…

…e linked glossary
  • Loading branch information...
1 parent 6548ce0 commit 8199b8748e15eff6865fdb2d3db3d237bc563a7e @grabs grabs committed Nov 6, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 blocks/glossary_random/block_glossary_random.php
@@ -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', get_context_instance(CONTEXT_MODULE, $cm->id))) {
- return '';
- }
if (!isset($modinfo->instances['glossary'][$glossaryid])) {
// we can get here if the glossary has been deleted, so
@@ -147,6 +142,12 @@ function get_content() {
return $this->content;
}
+ $cm = $modinfo->instances['glossary'][$glossaryid];
+
+ if (!has_capability('mod/glossary:view', get_context_instance(CONTEXT_MODULE, $cm->id))) {
+ return '';
+ }
+
if (empty($this->config->cache)) {
$this->config->cache = '';
}

0 comments on commit 8199b87

Please sign in to comment.