Merge branch 'mdl63321-master' of https://github.com/tlock/moodle
authorJun Pataleta <jun@moodle.com>
Wed, 12 Sep 2018 07:34:59 +0000 (15:34 +0800)
committerJun Pataleta <jun@moodle.com>
Wed, 12 Sep 2018 07:34:59 +0000 (15:34 +0800)
blocks/calendar_month/block_calendar_month.php

index 00547c6..64c2cd2 100644 (file)
@@ -49,7 +49,8 @@ class block_calendar_month extends block_base {
         $this->content->footer = '';
 
         $courseid = $this->page->course->id;
-        $categoryid = ($this->page->context->contextlevel === CONTEXT_COURSECAT) ? $this->page->category->id : null;
+        $categoryid = ($this->page->context->contextlevel === CONTEXT_COURSECAT && !empty($this->page->category)) ?
+            $this->page->category->id : null;
         $calendar = \calendar_information::create(time(), $courseid, $categoryid);
         list($data, $template) = calendar_get_view($calendar, 'mini', isloggedin(), isloggedin());