From 7f88c426082d22a90e450c5d9b3d2d5b5a5f2e34 Mon Sep 17 00:00:00 2001 From: Dan Poltawski Date: Tue, 5 Jun 2012 16:40:40 +0800 Subject: [PATCH] MDL-33441 course/lib.php prevent fatal error when no visible categories --- course/lib.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/course/lib.php b/course/lib.php index a5566d6a6bc..c45056bce1d 100644 --- a/course/lib.php +++ b/course/lib.php @@ -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'); -- 2.43.0