From 7933cc6be59518e31eb28dacac877fbad39021d7 Mon Sep 17 00:00:00 2001 From: moodler Date: Tue, 18 Jan 2005 06:03:26 +0000 Subject: [PATCH] Just a little bit more reobust in the face of badly-behaved blocks --- lib/blocklib.php | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/blocklib.php b/lib/blocklib.php index 7ee9305589..820bc55286 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -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) { -- 2.39.5