Browse Source

Check that the field name exists before continuing

Abdullah Almsaeed 6 years ago
parent
commit
0845c53417

+ 1 - 1
tripal/includes/TripalFieldDownloaders/TripalCSVDownloader.inc

@@ -54,7 +54,7 @@ class TripalCSVDownloader extends TripalFieldDownloader {
       $field_name = $field['field_name'];
 
       // If we only have one item for this value then add it.
-      if (is_array($entity->{$field_name}['und']) and count($entity->{$field_name}['und']) == 1) {
+      if ($field_name and is_array($entity->{$field_name}['und']) and count($entity->{$field_name}['und']) == 1) {
         $value = $entity->{$field_name}['und'][0]['value'];
 
         // If the single element is not an array then this is good.

+ 1 - 1
tripal/includes/TripalFieldDownloaders/TripalTabDownloader.inc

@@ -54,7 +54,7 @@ class TripalTabDownloader extends TripalFieldDownloader {
        $field_name = $field['field_name'];
 
        // If we only have one item for this value then add it.
-       if (is_array($entity->{$field_name}['und']) and count($entity->{$field_name}['und']) == 1) {
+       if ($field_name and is_array($entity->{$field_name}['und']) and count($entity->{$field_name}['und']) == 1) {
          $value = $entity->{$field_name}['und'][0]['value'];
 
          // If the single element is not an array then this is good.