MDL-33441 course/lib.php prevent fatal error when no visible categories

This commit is contained in:
Dan Poltawski 2012-06-05 16:40:40 +08:00
parent 4db061680e
commit 7f88c42608

View File

@ -2147,6 +2147,11 @@ function get_course_category_tree($id = 0, $depth = 0) {
return array($categories, $categoryids);
}
if (empty($categoryids)) {
// No categories available (probably all hidden).
return array();
}
// The depth is 0 this function has just been called so we can finish it off
list($ccselect, $ccjoin) = context_instance_preload_sql('c.id', CONTEXT_COURSE, 'ctx');