@@ -932,27 +932,33 @@ function hansel_cache_set($cid, $data) {
 /**
  * Implements of hook_token_values().
  */
 function hansel_token_values($type, $object = NULL, $options = array()) {
   global $_hansel_test_path;
-  
-  if (!in_array($type, array('node', 'taxonomy', 'user'))) {
+
+  $hansel_types = array(
+    'node' => 'node',
+    'term' => 'taxonomy_term',
+    'user' => 'user',
+  );
+  if (!array_key_exists($type, $hansel_types) || !isset($data[$htype]) || empty($data[$htype])) {
     return array();
   }
+  $object = $data[$hansel_types[$type]];
   
   switch ($type) {
     case 'node':
-      $_hansel_test_path = 'node/' . $object->nid;
-      $title = $object->title;
+        $_hansel_test_path = 'node/' . $object->nid;
+        $title = $object->title;
       break;
     case 'taxonomy':
-      $_hansel_test_path = 'taxonomy/term/' . $object->tid;
-      $title = $object->name;
+        $_hansel_test_path = 'taxonomy/term/' . $object->tid;
+        $title = $object->name;
       break;
     case 'user':
-      $_hansel_test_path = 'user/' . $object->uid;
-      $title = $object->name;
+        $_hansel_test_path = 'user/' . $object->uid;
+        $title = $object->name;
       break;
     default:
       return array();
   }
   

