Index: modules/taxonomy/taxonomy.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.module,v
retrieving revision 1.472
diff -u -p -r1.472 taxonomy.module
--- modules/taxonomy/taxonomy.module	3 May 2009 10:44:04 -0000	1.472
+++ modules/taxonomy/taxonomy.module	18 May 2009 18:45:32 -0000
@@ -825,11 +825,13 @@ function taxonomy_node_save($node, $term
         }
       }
       elseif (is_object($term)) {
-        $query->values(array(
-          'nid' => $node->nid,
-          'vid' => $node->vid,
-          'tid' => $term->tid,
-        ));
+        if ($term->tid) {
+          $query->values(array(
+            'nid' => $node->nid,
+            'vid' => $node->vid,
+            'tid' => $term->tid,
+          ));
+        }
       }
       elseif ($term) {
         $query->values(array(
