From be074bc3e6ea7901b8261fdfeddb90d1dd576cc3 Mon Sep 17 00:00:00 2001 From: tjhunt Date: Mon, 12 May 2008 10:44:42 +0000 Subject: [PATCH] MDL-14797 - Error when moving a course to an empty category on Postgres --- course/lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/course/lib.php b/course/lib.php index 1b9835c9b24..b7321546be1 100644 --- a/course/lib.php +++ b/course/lib.php @@ -1847,7 +1847,7 @@ function move_courses ($courseids, $categoryid) { // figure out a sortorder that we can use in the destination category $sortorder = get_field_sql('SELECT MIN(sortorder)-1 AS min FROM ' . $CFG->prefix . 'course WHERE category=' . $categoryid); - if ($sortorder === false) { + if (is_null($sortorder) || $sortorder === false) { // the category is empty // rather than let the db default to 0 // set it to > 100 and avoid extra work in fix_coursesortorder()