Index: token.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.module,v
retrieving revision 1.7.4.51
diff -u -r1.7.4.51 token.module
--- token.module	12 Jan 2011 04:06:43 -0000	1.7.4.51
+++ token.module	20 Jan 2011 00:23:07 -0000
@@ -320,6 +320,12 @@
     $tokens = array();
   }
 
+  // In some cases it is possible for an unknown reason that the $user object does
+  // not exists or is empty!? See http://drupal.org/node/1026892
+  if (empty($object) && $type = 'user') {
+    $object = user_load(array('uid' => $GLOBALS['user']->uid));
+  }
+
   // Since objects in PHP5 are always passed by reference, we ensure we're
   // working on a copy of the object.
   if (is_object($object)) {
Index: token_user.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/Attic/token_user.inc,v
retrieving revision 1.3.4.12
diff -u -r1.3.4.12 token_user.inc
--- token_user.inc	11 Nov 2010 00:12:20 -0000	1.3.4.12
+++ token_user.inc	20 Jan 2011 00:23:07 -0000
@@ -42,12 +42,7 @@
   $values = array();
   switch ($type) {
     case 'user':
-      if (!empty($object)) {
-        $account = $object;
-      }
-      else {
-        $account = user_load(array('uid' => $GLOBALS['user']->uid));
-      }
+      $account = $object;
 
       // Adjust for the anonymous user name.
       if (!$account->uid && !$account->name) {
