diff --git a/pathauto.module b/pathauto.module
index 06611a8..46b1ab0 100644
--- a/pathauto.module
+++ b/pathauto.module
@@ -135,7 +135,7 @@ function pathauto_token_values($type, $object = NULL, $options = array(), $label
       }
 
       // Tokens [termpath], [termpath-raw], and [termalias].
-      if (module_exists('taxonomy')) {
+      if (isset($object->vid) && module_exists('taxonomy')) {
         // Get the lowest-weighted term from the lowest-weighted vocabulary.
         // This query is copied from @taxonomy_node_get_terms()
         $term = db_fetch_object(db_query_range('SELECT t.* 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.vid = %d ORDER BY v.weight, t.weight, t.name', $object->vid, 0, 1));
