소스 검색

Fix invalid type in foreach loop

Abdullah Almsaeed 6 년 전
부모
커밋
0efda724a3
1개의 변경된 파일6개의 추가작업 그리고 1개의 파일을 삭제
  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 {
       }
     }
   }
-}
+}