Index: token_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token_node.inc,v
retrieving revision 1.5.4.2
diff -u -p -r1.5.4.2 token_node.inc
--- token_node.inc	8 Nov 2007 14:48:00 -0000	1.5.4.2
+++ token_node.inc	8 Apr 2008 23:21:15 -0000
@@ -94,6 +94,9 @@ function node_token_values($type, $objec
             // pull it out of the db here.
             if (!isset($term->name) || !isset($term->tid)) {
               $vid = db_result(db_query("SELECT t.vid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name LIMIT 1", $object->nid));
+              if (!$vid) {
+                continue;
+              }
               $term = db_fetch_object(db_query("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.nid = %d ORDER BY weight LIMIT 1", $vid, $object->nid));
               $term->vid = $vid;
             }
@@ -199,7 +202,7 @@ function book_token_values($type, $objec
     $node = $object;
 
     $tokens = array();
-    if ($node->parent) {
+    if (!empty($node->parent)) {
       $path = book_location($node);
       $tokens['book'] = check_plain($path[0]->title);
       $tokens['book-raw'] = $path[0]->title;
