### Eclipse Workspace Patch 1.0 #P moodle Index: lib/blocklib.php =================================================================== RCS file: /cvsroot/moodle/moodle/lib/blocklib.php,v retrieving revision 1.185 diff -u -r1.185 blocklib.php --- lib/blocklib.php 12 Jun 2009 11:58:12 -0000 1.185 +++ lib/blocklib.php 24 Jun 2009 17:50:38 -0000 @@ -1253,6 +1253,9 @@ $region = $page->blocks->get_default_region(); $weight = $DB->get_field_sql("SELECT MAX(defaultweight) FROM {block_instances} WHERE contextid = ? AND defaultregion = ?", array($page->context->id, $region)); + if (is_null($weight)) { + $weight = 0; + } $pagetypepattern = $page->pagetype; if (strpos($pagetypepattern, 'course-view') === 0) { $pagetypepattern = 'course-view-*';