mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-12 09:52:20 +00:00
Fix nullpointer
This commit is contained in:
@@ -186,8 +186,7 @@ class CreditRecalculateService
|
|||||||
$transactions = $account->transactions()
|
$transactions = $account->transactions()
|
||||||
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
->leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||||
->orderBy('transaction_journals.date', 'ASC')
|
->orderBy('transaction_journals.date', 'ASC')
|
||||||
->get(['transactions.*'])
|
->get(['transactions.*']);
|
||||||
;
|
|
||||||
$total = $transactions->count();
|
$total = $transactions->count();
|
||||||
app('log')->debug(sprintf('Found %d transaction(s) to process.', $total));
|
app('log')->debug(sprintf('Found %d transaction(s) to process.', $total));
|
||||||
|
|
||||||
@@ -242,6 +241,14 @@ class CreditRecalculateService
|
|||||||
private function processTransaction(Account $account, string $direction, Transaction $transaction, string $leftOfDebt): string
|
private function processTransaction(Account $account, string $direction, Transaction $transaction, string $leftOfDebt): string
|
||||||
{
|
{
|
||||||
$journal = $transaction->transactionJournal;
|
$journal = $transaction->transactionJournal;
|
||||||
|
|
||||||
|
// here be null pointers.
|
||||||
|
if (null === $journal) {
|
||||||
|
app('log')->warning(sprintf('Transaction #%d has no journal.', $transaction->id));
|
||||||
|
return $leftOfDebt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$foreignCurrency = $transaction->foreignCurrency;
|
$foreignCurrency = $transaction->foreignCurrency;
|
||||||
$accountCurrency = $this->repository->getAccountCurrency($account);
|
$accountCurrency = $this->repository->getAccountCurrency($account);
|
||||||
$type = $journal->transactionType->type;
|
$type = $journal->transactionType->type;
|
||||||
|
|||||||
Reference in New Issue
Block a user