diff --git a/app/Services/Logic/UserTrait.php b/app/Services/Logic/UserTrait.php index 68dbf048..2f379c30 100644 --- a/app/Services/Logic/UserTrait.php +++ b/app/Services/Logic/UserTrait.php @@ -29,10 +29,14 @@ trait UserTrait public function handleShallowUserInfo($id) { + if (empty($id)) return new \stdClass(); + $userRepo = new UserRepo(); $user = $userRepo->findShallowUserById($id); + if (!$user) return new \stdClass(); + $result = $user->toArray(); $result['avatar'] = kg_cos_user_avatar_url($user->avatar);