From dd5406527aeea0e683eb84ea17bf918f3653e4f6 Mon Sep 17 00:00:00 2001 From: Eric Merrill Date: Fri, 18 Mar 2022 15:30:19 -0400 Subject: [PATCH] MDL-74269 course: Make sure category exists before updating --- lib/db/upgrade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/db/upgrade.php b/lib/db/upgrade.php index 0ae919425ac..c6a02431b21 100644 --- a/lib/db/upgrade.php +++ b/lib/db/upgrade.php @@ -2764,7 +2764,7 @@ function xmldb_main_upgrade($oldversion) { // Set the description field to HTML format for the Default course category. $category = $DB->get_record('course_categories', ['id' => 1]); - if ($category->descriptionformat == FORMAT_MOODLE) { + if (!empty($category) && $category->descriptionformat == FORMAT_MOODLE) { // Format should be changed only if it's still set to FORMAT_MOODLE. if (!is_null($category->description)) { // If description is not empty, format the content to HTML.