瀏覽代碼

Add term check when retrieving details.

Lacey Sanderson 6 年之前
父節點
當前提交
7a9ee49e9d
共有 1 個文件被更改,包括 10 次插入0 次删除
  1. 10 0
      tripal/api/tripal.terms.api.inc

+ 10 - 0
tripal/api/tripal.terms.api.inc

@@ -355,7 +355,17 @@ function tripal_get_term_details($vocabulary, $accession) {
     $module = $stores[$keys[0]]['module'];
     $function = $module . '_vocab_get_term';
     if (function_exists($function)) {
+
       $term = $function($vocabulary, $accession);
+      if (!$term) {
+        tripal_report_error(
+          'tripal',
+          TRIPAL_ERROR,
+          "Unable to find term for :vocab, :accession.",
+          [':vocab' => $vocabulary, ':accession' => $accession]
+        );
+        return FALSE;
+      }
 
       // If the vocabulary is missing then we have a problem.
       if (!array_key_exists('vocabulary', $term)) {