From 2e477369d3ec1f545956a6e2fd9ba3d1e2ea035e Mon Sep 17 00:00:00 2001 From: defacer Date: Tue, 14 Jun 2005 20:33:39 +0000 Subject: [PATCH] Merging from STABLE: Fix for bug 3510: Due to stupidly copy/pasting some code, deleting a block instance could, under some circumstances, throw a fatal error. --- lib/blocklib.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/blocklib.php b/lib/blocklib.php index 81baea4e10d..0f50035e0ce 100644 --- a/lib/blocklib.php +++ b/lib/blocklib.php @@ -185,10 +185,10 @@ function blocks_delete_instance($instance) { // Get the block object and call instance_delete() first if(!$record = blocks_get_record($instance->blockid)) { - continue; + return false; } if(!$obj = block_instance($record->name, $instance)) { - continue; + return false; } // Return value ignored @@ -200,6 +200,7 @@ function blocks_delete_instance($instance) { execute_sql('UPDATE '.$CFG->prefix.'block_instance SET weight = weight - 1 WHERE pagetype = \''.$instance->pagetype. '\' AND pageid = '.$instance->pageid.' AND position = \''.$instance->position. '\' AND weight > '.$instance->weight, false); + return true; } // Accepts an array of block instances and checks to see if any of them have content to display