]> git.mjollnir.org Git - moodle.git/commitdiff
Just a little bit more reobust in the face of badly-behaved blocks
authormoodler <moodler>
Tue, 18 Jan 2005 06:03:26 +0000 (06:03 +0000)
committermoodler <moodler>
Tue, 18 Jan 2005 06:03:26 +0000 (06:03 +0000)
lib/blocklib.php

index 7ee9305589e58a59676ada0617c471072632b128..820bc552861bc16d02f5eda22066549f3e5d4605 100644 (file)
@@ -154,11 +154,15 @@ function blocks_delete_instance($instance) {
 // by reference for speed; the array is actually not modified.
 function blocks_have_content(&$instances) {
     foreach($instances as $instance) {
-        if(!$instance->visible) {
+        if (!$instance->visible) {
+            continue;
+        }
+        if (!$record = blocks_get_record($instance->blockid)) {
+            continue;
+        }
+        if (!$obj = block_instance($record->name, $instance)) {
             continue;
         }
-        $record = blocks_get_record($instance->blockid);
-        $obj = block_instance($record->name, $instance);
         $content = $obj->get_content();
         $type = $obj->get_content_type();
         switch($type) {