Skip to content

Commit

Permalink
Fix for bug 3510:
Browse files Browse the repository at this point in the history
Due to stupidly copy/pasting some code, deleting a block instance could,
under some circumstances, throw a fatal error.
  • Loading branch information
defacer committed Jun 14, 2005
1 parent d031cf0 commit 9b8a859
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/blocklib.php
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 9b8a859

Please sign in to comment.