Fixed error for unpublished tracks

This commit is contained in:
Josef Citrine 2016-05-04 01:26:52 +01:00
parent ccb92606e8
commit 7b4cf4adff

View file

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