This commit is contained in:
James Cole 2023-05-03 05:59:10 +02:00
parent 3fae6c0cac
commit fb823ed422
No known key found for this signature in database
GPG Key ID: B49A324B7EAD6D80

View File

@ -180,7 +180,14 @@ class BudgetLimitHandler
$start = app('navigation')->startOfPeriod($budgetLimit->start_date, $viewRange);
$end = app('navigation')->startOfPeriod($budgetLimit->end_date, $viewRange);
$end = app('navigation')->endOfPeriod($end, $viewRange);
$user = $budgetLimit->budget->user;
$user = $budgetLimit?->budget?->user;
// sanity check. It's rare but this happens.
if(null === $user) {
Log::warning('User is null, cannot continue.');
$budgetLimit->forceDelete();
return;
}
// limit period in total is:
$limitPeriod = Period::make($start, $end, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE());