Skip to content

Firefly III: a personal finances manager

Fix issue when DB is empty.

James Cole2cb61ea5014f
diff --git a/app/Console/Commands/Correction/RemoveBills.php b/app/Console/Commands/Correction/RemoveBills.php
index 4966c1887a..d86b878933 100644
--- a/app/Console/Commands/Correction/RemoveBills.php
+++ b/app/Console/Commands/Correction/RemoveBills.php
@@ -55,6 +55,9 @@ class RemoveBills extends Command
$start = microtime(true);
/** @var TransactionType $withdrawal */
$withdrawal = TransactionType::where('type', TransactionType::WITHDRAWAL)->first();
+ if(null === $withdrawal) {
+ return 0;
+ }
$journals = TransactionJournal::whereNotNull('bill_id')->where('transaction_type_id', '!=', $withdrawal->id)->get();
/** @var TransactionJournal $journal */
foreach ($journals as $journal) {