Skip to content

Firefly III: a personal finances manager

Skip if null

James Cole1c2b14868bfc
diff --git a/app/Console/Commands/Correction/FixPostgresSequences.php b/app/Console/Commands/Correction/FixPostgresSequences.php
index 7c3d19fa42..0496b81f2e 100644
--- a/app/Console/Commands/Correction/FixPostgresSequences.php
+++ b/app/Console/Commands/Correction/FixPostgresSequences.php
@@ -104,6 +104,10 @@ class FixPostgresSequences extends Command
$highestId = DB::table($tableToCheck)->select(DB::raw('MAX(id)'))->first();
$nextId = DB::table($tableToCheck)->select(DB::raw(sprintf('nextval(\'%s_id_seq\')', $tableToCheck)))->first();
+ if(null === $nextId) {
+ $this->line(sprintf('nextval is NULL for table "%s"', $tableToCheck));
+ continue;
+ }
if ($nextId->nextval < $highestId->max) {
DB::select(sprintf('SELECT setval(\'%s_id_seq\', %d)', $tableToCheck, $highestId->max));