Permalink
Browse files

MDL-31502 Check whether a category has subcategories or courses withi…

…n it before using those variables
  • Loading branch information...
1 parent d66b350 commit 408844eea19ae3b8d862be3fc4c3e5f51245d09b @andrewnicols andrewnicols committed with Sam Hemelryk Feb 6, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 course/renderer.php
View
@@ -92,8 +92,8 @@ public function course_category_tree(array $structure) {
*/
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';

0 comments on commit 408844e

Please sign in to comment.