Merge pull request #381 from jeroensmeets/dev

prevent crash when avatar not set on fresh install
This commit is contained in:
daniel 2018-08-15 18:19:52 -06:00 committed by GitHub
commit df96b800c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -132,7 +132,7 @@ class Profile extends Model
{
$url = Cache::remember("avatar:{$this->id}", 1440, function() {
$path = $this->avatar->media_path ?? 'public/avatars/default.png';
$version = hash('sha1', $this->avatar->created_at);
$version = $this->avatar ? hash('sha1', $this->avatar->created_at) : '';
$path = "{$path}?v={$version}";
return url(Storage::url($path));
});