Index: modules/block/block.js =================================================================== RCS file: /cvs/drupal/drupal/modules/block/block.js,v retrieving revision 1.9 diff -u -p -r1.9 block.js --- modules/block/block.js 21 May 2009 21:12:22 -0000 1.9 +++ modules/block/block.js 1 Jun 2009 16:10:19 -0000 @@ -11,11 +11,18 @@ Drupal.behaviors.blockDrag = { attach: function (context, settings) { var table = $('table#blocks'); var tableDrag = Drupal.tableDrag.blocks; // Get the blocks tableDrag object. - + if (!tableDrag) { + // If the block page is loaded using ajax and then removed, tableDrag + // and tableDrag.row may not be defined. + return; + } + // Add a handler for when a row is swapped, update empty regions. - tableDrag.row.prototype.onSwap = function (swappedRow) { - checkEmptyRegions(table, this); - }; + if (tableDrag.row) { + tableDrag.row.prototype.onSwap = function (swappedRow) { + checkEmptyRegions(table, this); + }; + } // A custom message for the blocks page specifically. Drupal.theme.tableDragChangedWarning = function () {