diff --git a/main/gradebook/lib/flatview_data_generator.class.php b/main/gradebook/lib/flatview_data_generator.class.php index 8d58c5a491..90c6593d28 100755 --- a/main/gradebook/lib/flatview_data_generator.class.php +++ b/main/gradebook/lib/flatview_data_generator.class.php @@ -115,8 +115,9 @@ class FlatViewDataGenerator $sum_categories_weight_array = array(); $mainCategoryId = null; - if (!empty($this->getMainCourseCategory())) { - $mainCategoryId = $this->getMainCourseCategory()->get_id(); + $mainCourseCategory = $this->getMainCourseCategory(); + if (!empty($mainCourseCategory)) { + $mainCategoryId = $mainCourseCategory->get_id(); } if (isset($this->category) && !empty($this->category)) {