? modules/taxonomy/.cvsignore
Index: modules/taxonomy/taxonomy.pages.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/taxonomy/taxonomy.pages.inc,v
retrieving revision 1.57
diff -u -r1.57 taxonomy.pages.inc
--- modules/taxonomy/taxonomy.pages.inc	23 Nov 2010 02:56:10 -0000	1.57
+++ modules/taxonomy/taxonomy.pages.inc	14 Feb 2011 16:54:11 -0000
@@ -77,10 +77,21 @@
 }
 
 /**
- * Helper function for autocompletion
+ * AJAX page callback for taxonomy tag autocompletion.
+ *
+ * @param $field_name
+ *   The name of the tag field.
+ * @param $tags_typed
+ *   A comma-separated list of tags that the user has entered into the field.
  */
 function taxonomy_autocomplete($field_name, $tags_typed = '') {
-  $field = field_info_field($field_name);
+  // Make sure the field exists and is a taxonomy field.
+  if (!($field = field_info_field($field_name)) || $field['type'] !== 'taxonomy_term_reference') {
+    // Error string. The JavaScript handler will realize this is not JSON and
+    // will display it as debugging information.
+    print t('Taxonomy field @field_name not found.', array('@field_name' => $field_name));
+    exit;
+  }
 
   // The user enters a comma-separated list of tags. We only autocomplete the last tag.
   $tags_typed = drupal_explode_tags($tags_typed);
