Ver código fonte

没有设置channel 报错

visuddhinanda 2 anos atrás
pai
commit
5514f09b6e
1 arquivos alterados com 9 adições e 0 exclusões
  1. 9 0
      app/Http/Api/TemplateRender.php

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

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