From 2cb61ea5014ff95dc18256628004aeb2e9474bad Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 30 Jul 2020 20:55:58 +0200 Subject: [PATCH] Fix issue when DB is empty. --- app/Console/Commands/Correction/RemoveBills.php | 3 +++ 1 file changed, 3 insertions(+) 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) {