Skip to content

Firefly III: a personal finances manager

Fix opening balance bug #214

James Coleccad52b80f96
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index b185d6ac3e..96cb9b7d48 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -450,8 +450,9 @@ class AccountRepository implements AccountRepositoryInterface
$this->updateMetadata($account, $data);
$openingBalance = $this->openingBalanceTransaction($account);
+
if ($data['openingBalance'] != 0) {
- if ($openingBalance) {
+ if (!is_null($openingBalance->id)) {
$this->updateInitialBalance($account, $openingBalance, $data);
} else {
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';