Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.1039 diff -u -p -r1.1039 user.module --- modules/user/user.module 5 Sep 2009 05:45:45 -0000 1.1039 +++ modules/user/user.module 8 Sep 2009 08:20:21 -0000 @@ -2910,12 +2910,19 @@ function user_block_user_action(&$object global $user; $uid = $user->uid; } - db_update('users') - ->fields(array('status' => 0)) - ->condition('uid', $uid) - ->execute(); - drupal_session_destroy_uid($uid); - watchdog('action', 'Blocked user %name.', array('%name' => $user->name)); + + if ($uid) { + $account = user_load($uid); + db_update('users') + ->fields(array('status' => 0)) + ->condition('uid', $uid) + ->execute(); + drupal_session_destroy_uid($uid); + watchdog('action', 'Blocked user %name.', array('%name' => $account->name)); + } + else { + watchdog('action', 'Attempted to block a user but no UID was supplied.'); + } } /**