Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

…n it before using those variables
  • Loading branch information...
commit 8c51b948d62e47ab6bb34aac1fa9aabe4c39078b 1 parent f7562f7
@andrewnicols andrewnicols authored samhemelryk committed
Showing with 2 additions and 2 deletions.
  1. +2 −2 course/renderer.php
View
4 course/renderer.php
@@ -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';
Please sign in to comment.
Something went wrong with that request. Please try again.