Sfoglia il codice sorgente

没有设置channel 报错

visuddhinanda 2 anni fa
parent
commit
5514f09b6e
1 ha cambiato i file con 9 aggiunte e 0 eliminazioni
  1. 9 0
      app/Http/Api/TemplateRender.php

+ 9 - 0
app/Http/Api/TemplateRender.php

@@ -104,6 +104,15 @@ class TemplateRender{
             $channelId = null;
         }
 
+
+        if(count($this->channelInfo)===0){
+            Log::error('channel is null');
+            $output = [
+                "word" => $word,
+                'innerHtml' => '',
+            ];
+            return $output;
+        }
         $channelInfo = $this->channelInfo[0];
         if(Str::isUuid($channelId)){
             $lang = Channel::where('uid',$channelId)->value('lang');