mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-25 14:37:59 +01:00
Fixed error for unpublished tracks
This commit is contained in:
parent
ccb92606e8
commit
7b4cf4adff
1 changed files with 5 additions and 0 deletions
|
@ -146,6 +146,11 @@ class StatsController extends ApiControllerBase
|
|||
$now = Carbon::now();
|
||||
$trackDate = $track->published_at;
|
||||
|
||||
// Error catching for tracks that don't exist anymore
|
||||
// or are not published
|
||||
if ($trackDate == null)
|
||||
return $this->notFound('Track not found!');
|
||||
|
||||
if ($trackDate->diffInDays($now) >= 1)
|
||||
return $this->getTrackStatsDaily($id);
|
||||
|
||||
|
|
Loading…
Reference in a new issue