Showing
1 changed file
with
10 additions
and
2 deletions
| ... | @@ -160,8 +160,16 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon | ... | @@ -160,8 +160,16 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon |
| 160 | */ | 160 | */ |
| 161 | public function getAvatar($size = 50) | 161 | public function getAvatar($size = 50) |
| 162 | { | 162 | { |
| 163 | - if ($this->image_id === 0 || $this->image_id === '0' || $this->image_id === null) return baseUrl('/user_avatar.png'); | 163 | + $default = baseUrl('/user_avatar.png'); |
| 164 | - return baseUrl($this->avatar->getThumb($size, $size, false)); | 164 | + $imageId = $this->image_id; |
| 165 | + if ($imageId === 0 || $imageId === '0' || $imageId === null) return $default; | ||
| 166 | + | ||
| 167 | + try { | ||
| 168 | + $avatar = baseUrl($this->avatar->getThumb($size, $size, false)); | ||
| 169 | + } catch (\Exception $err) { | ||
| 170 | + $avatar = $default; | ||
| 171 | + } | ||
| 172 | + return $avatar; | ||
| 165 | } | 173 | } |
| 166 | 174 | ||
| 167 | /** | 175 | /** | ... | ... |
-
Please register or sign in to post a comment