Skip to content

Firefly III: a personal finances manager

Fixed null pointer in debug message [skip ci]

James Cole3bf50403242c
diff --git a/app/Repositories/Account/AccountTasker.php b/app/Repositories/Account/AccountTasker.php
index e5c81eb211..e5c4ab1bfb 100644
--- a/app/Repositories/Account/AccountTasker.php
+++ b/app/Repositories/Account/AccountTasker.php
@@ -127,12 +127,12 @@ class AccountTasker implements AccountTaskerInterface
// get first journal date:
$first = $repository->oldestJournal($account);
- Log::debug(sprintf('Date of first journal for %s is %s', $account->name, $first->date->format('Y-m-d')));
$entry['start_balance'] = $startSet[$account->id] ?? '0';
$entry['end_balance'] = $endSet[$account->id] ?? '0';
// first journal exists, and is on start, then this is the actual opening balance:
if (!is_null($first->id) && $first->date->isSameDay($start)) {
+ Log::debug(sprintf('Date of first journal for %s is %s', $account->name, $first->date->format('Y-m-d')));
$entry['start_balance'] = $first->transactions()->where('account_id', $account->id)->first()->amount;
Log::debug(sprintf('Account %s was opened on %s, so opening balance is %f', $account->name, $start->format('Y-m-d'), $entry['start_balance']));
}