diff --git a/apachesolr.index.inc b/apachesolr.index.inc
index 94588ef..6d92261 100644
--- a/apachesolr.index.inc
+++ b/apachesolr.index.inc
@@ -123,8 +123,19 @@ function apachesolr_index_entities_document($row, $entity_type, $env_id) {
       }
     }
     if ($build_document) {
-      // TODO argument #2 is not an array
-      $documents = array_merge($documents, apachesolr_index_entity_to_documents($row, $env_id));
+      $new_documents = apachesolr_index_entity_to_documents($row, $env_id);
+      if (is_array($new_documents)) {
+        $documents = array_merge($documents, $new_documents);
+      }
+      else {
+        watchdog('Apache Solr', 'Could not add entity of type %type to index. Row: %row',
+          array(
+            '%type' => $entity_type,
+            '%row' => var_export($row, TRUE)
+          ),
+          WATCHDOG_WARNING
+        );
+      }
     }
   }
   else {
