Index: modules/user/user.module =================================================================== RCS file: /cvs/drupal/drupal/modules/user/user.module,v retrieving revision 1.1014 diff -u -p -r1.1014 user.module --- modules/user/user.module 28 Jul 2009 19:32:33 -0000 1.1014 +++ modules/user/user.module 29 Jul 2009 07:03:47 -0000 @@ -2735,12 +2735,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.'); + } } /**