1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-23 16:24:29 +00:00

prevent crash when avatar not set on fresh install

This commit is contained in:
Jeroen Smeets 2018-08-15 09:51:01 +02:00
parent 9fba7017fc
commit bdc8ec77f0

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));
});