fly 5 years ago
parent
commit
7f8bac57b6
1 changed files with 5 additions and 3 deletions
  1. 5 3
      app/Modules/User/Services/SiteUser.php

+ 5 - 3
app/Modules/User/Services/SiteUser.php

@@ -79,7 +79,7 @@ class SiteUser
             }
         }
         if (!$this->users) {
-            $this->users = $users;
+            $this->users = $users ?? [];
         }
         if (count($this->users) == 1) {
             $this->setUserLink($this->users[0]->id);
@@ -177,8 +177,10 @@ class SiteUser
      */
     private function getUserFromLast()
     {
-        $this->setUserLink($this->users[0]->id);
-        $this->channel_id = $this->users[0]->distribution_channel_id;
+        if ($this->users) {
+            $this->setUserLink($this->users[0]->id);
+            $this->channel_id = $this->users[0]->distribution_channel_id;
+        }
     }
 
     private function setUserLink($uid)