Browse Source

Fix invalid type in foreach loop

Abdullah Almsaeed 6 years ago
parent
commit
0efda724a3
1 changed files with 6 additions and 1 deletions
  1. 6 1
      tripal_chado/includes/TripalFields/so__cds/so__cds.inc

+ 6 - 1
tripal_chado/includes/TripalFields/so__cds/so__cds.inc

@@ -79,6 +79,11 @@ class so__cds extends ChadoField {
     $feature = chado_expand_var($feature, 'table', 'featureloc', $options);
     $featurelocs = $feature->featureloc->feature_id;
 
+    // Verify that we have featurelocs before entering the loop
+    if(!is_array($featurelocs)) {
+      return;
+    }
+
     foreach($featurelocs as $featureloc){
       // Generate a CDS sequence if one exsits for this feature alignment.
       $cds_sequence = chado_get_feature_sequences(
@@ -111,4 +116,4 @@ class so__cds extends ChadoField {
       }
     }
   }
-}
+}