MDL-31502 Check whether a category has subcategories or courses within it before...
[moodle.git] / course / renderer.php
index 3e9898c..1e1d7ad 100644 (file)
@@ -92,8 +92,8 @@ class core_course_renderer extends plugin_renderer_base {
      */
     protected function course_category_tree_category(stdClass $category, $depth=1) {
         $content = '';
-        $hassubcategories = (count($category->categories)>0);
-        $hascourses = (count($category->courses)>0);
+        $hassubcategories = (isset($category->categories) && count($category->categories)>0);
+        $hascourses = (isset($category->courses) && count($category->courses)>0);
         $classes = array('category');
         if ($category->parent != 0) {
             $classes[] = 'subcategory';