# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/field_collection.module
+++ b/field_collection.module
@@ -1669,7 +1669,19 @@
   $language = $element['#language'];

   $field_state = field_form_get_state($field_parents, $field_name, $language, $form_state);
+
+  //We have to populate the field_collection_item before we can attach it to the form.
+  if (isset($field_state['entity'][$element['#delta']])) {
   $field_collection_item = $field_state['entity'][$element['#delta']];
+  }
+  elseif ($form_state['input'][$field_state['array_parents'][0]][$field_state['array_parents'][1]][$element['#delta']]) {
+    $field_collection_item = clone $field_state['entity'][0];
+    foreach ($form_state['input'][$field_state['array_parents'][0]][$field_state['array_parents'][1]][$element['#delta']] as $key => $value) {
+      if (property_exists($field_collection_item, $key)) {
+       $field_collection_item->{$key} = $value;
+      }
+    }
+  }

   // Attach field API validation of the embedded form.
   field_attach_form_validate('field_collection_item', $field_collection_item, $element, $form_state);
