mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-27 15:27:58 +01:00
Null handling of soft deleted tracks for favourites page
Null handling of soft deleted tracks for favourites page
This commit is contained in:
commit
4bec8e2587
1 changed files with 7 additions and 2 deletions
|
@ -91,8 +91,11 @@ class Favourite extends Model
|
|||
} else {
|
||||
if ($this->playlist_id) {
|
||||
return $this->playlist;
|
||||
} // no resource - this should never happen under real circumstances
|
||||
}
|
||||
else {
|
||||
// No resource
|
||||
// In this case, either the resource was
|
||||
// soft-deleted or something else occurred.
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +104,8 @@ class Favourite extends Model
|
|||
|
||||
public function getTypeAttribute()
|
||||
{
|
||||
return get_class($this->resource);
|
||||
// As of PHP 7.2, get_class is picky about null args
|
||||
$resource = $this->resource;
|
||||
return $resource ? get_class($resource) : null;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue