MDL-31502 Check whether a category has subcategories or courses within it before...
authorAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Mon, 6 Feb 2012 11:59:07 +0000 (11:59 +0000)
committerAndrew Robert Nicols <andrew.nicols@luns.net.uk>
Tue, 7 Feb 2012 09:30:04 +0000 (09:30 +0000)
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';