Procházet zdrojové kódy

没有设置channel 报错

visuddhinanda před 2 roky
rodič
revize
5514f09b6e
1 změnil soubory, kde provedl 9 přidání a 0 odebrání
  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');