mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-29 18:20:01 +00:00
This fixes a null pointer exception. [skip ci]
This commit is contained in:
@@ -252,7 +252,7 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
foreach ($creditCards as $creditCard) {
|
foreach ($creditCards as $creditCard) {
|
||||||
if ($creditCard->balance == 0) {
|
if ($creditCard->balance == 0) {
|
||||||
// find a transfer TO the credit card which should account for anything paid. If not, the CC is not yet used.
|
// find a transfer TO the credit card which should account for anything paid. If not, the CC is not yet used.
|
||||||
$set = TransactionJournal::whereIn(
|
$set = TransactionJournal::whereIn(
|
||||||
'transaction_journals.id', function (Builder $q) use ($creditCard, $start, $end) {
|
'transaction_journals.id', function (Builder $q) use ($creditCard, $start, $end) {
|
||||||
$q->select('transaction_journals.id')
|
$q->select('transaction_journals.id')
|
||||||
->from('transactions')
|
->from('transactions')
|
||||||
@@ -270,8 +270,8 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
$join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '>', 0);
|
$join->on('transactions.transaction_journal_id', '=', 'transaction_journals.id')->where('transactions.amount', '>', 0);
|
||||||
}
|
}
|
||||||
)->first([DB::raw('SUM(`transactions`.`amount`) as `sum_amount`')]);
|
)->first([DB::raw('SUM(`transactions`.`amount`) as `sum_amount`')]);
|
||||||
|
$sumAmount = $set->sum_amount ?? '0';
|
||||||
$amount = bcadd($amount, $set->sum_amount);
|
$amount = bcadd($amount, $sumAmount);
|
||||||
} else {
|
} else {
|
||||||
$amount = bcadd($amount, $creditCard->balance);
|
$amount = bcadd($amount, $creditCard->balance);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user