From a6d1daa5375d296682697d0d079af09d59646f95 Mon Sep 17 00:00:00 2001
From: James Silver <jamsilver@gmail.com>
Date: Wed, 30 May 2012 14:33:09 +0100
Subject: [PATCH] Issue #1120406 by Agileware,jamsilver: Fixed Error messages when converting nodes with image/file fields.

---
 node_convert.module |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/node_convert.module b/node_convert.module
index 821af8e..2a4b8e1 100755
--- a/node_convert.module
+++ b/node_convert.module
@@ -917,13 +917,15 @@ function node_convert_field_convert(&$node, $source_field, $dest_field) {
   // We put each field value back into the DB
   // To do it we first get the id of the field, then we find its language code from the source value
   // We add $source_values into the node object, and invoke field_storage write
-  $field_ids = array($field_info_dest['id'] => $field_info_dest['id']);
-  $langcode = field_language('node', $node, $source_field);
-  $node->{$dest_field}[$langcode] = $source_values;
-  try {
-    module_invoke($db_info_dest['module'], 'field_storage_write', 'node', $node, FIELD_STORAGE_INSERT, $field_ids);
-  } catch (Exception $e) {
-      drupal_set_message(t('Caught exception: @exception', array('@exception' => $e->getMessage())));
+  if ($source_values !== FALSE) {
+    $field_ids = array($field_info_dest['id'] => $field_info_dest['id']);
+    $langcode = field_language('node', $node, $source_field);
+    $node->{$dest_field}[$langcode] = $source_values;
+    try {
+      module_invoke($db_info_dest['module'], 'field_storage_write', 'node', $node, FIELD_STORAGE_INSERT, $field_ids);
+    } catch (Exception $e) {
+        drupal_set_message(t('Caught exception: @exception', array('@exception' => $e->getMessage())));
+    }
   }
 }
 
-- 
1.7.1

