Index: includes/content.node_form.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/cck/includes/content.node_form.inc,v
retrieving revision 1.7
diff -u -p -r1.7 content.node_form.inc
--- includes/content.node_form.inc  28 May 2008 20:40:45 -0000  1.7
+++ includes/content.node_form.inc  12 Jun 2008 01:12:45 -0000
@@ -245,7 +245,8 @@ function content_add_more_js($type_name_
   $field = content_fields($field_name, $type['type']);
   if ($field['multiple'] != 1) {
     // TODO : is that correct ?
-    drupal_json(array('status' => 0));
+    drupal_json(array('data' => ''));
+    exit;
   }

   // Reorder values to account for drag-n-drop reordering
@@ -254,7 +255,11 @@ function content_add_more_js($type_name_
   // Retrieve the cached form.
   $form_state = array('values' => $_POST);
   $form = form_get_cache($_POST['form_build_id'], $form_state);
-
+  if (!$form) {
+    // An invalid form_build_id.
+    drupal_json(array('data' => ''));
+    exit;
+  }
   // Build our new form element for the whole field,
   // and let other modules alter it.
   $form_element = content_field_form($form, $form_state, $field);
@@ -269,7 +274,7 @@ function content_add_more_js($type_name_
   }

   // Save the new definition of the form.
-  form_set_cache($_POST['form_build_id'], $form, $form_state);
+  form_set_cache($_POST['form_build_id'], $form, array());

   // Build the new form so that we can render the new element.
   $_POST[$field_name][$delta]['_weight'] = $delta;   // TODO : Hack !!
@@ -290,4 +295,5 @@ function content_add_more_js($type_name_
   $field_form[$delta]['#suffix'] = (isset($field_form[$delta]['#suffix']) ? $field_form[$delta]['#suffix'] : '') .'</div>';
   $output = theme('status_messages') . drupal_render($field_form);
   drupal_json(array('status' => TRUE, 'data' => $output));
+  exit;
 }
