From 436f07e79de8ebc09d48f7447b5e15c0b9401327 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 2 Feb 2022 16:26:56 +0000 Subject: [PATCH] Don't panic on nil txns --- internal/sqlutil/sql.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/sqlutil/sql.go b/internal/sqlutil/sql.go index 8d0d2dfa5..e026f452c 100644 --- a/internal/sqlutil/sql.go +++ b/internal/sqlutil/sql.go @@ -40,6 +40,11 @@ type Transaction interface { // You MUST check the error returned from this function to be sure that the transaction // was applied correctly. For example, 'database is locked' errors in sqlite will happen here. func EndTransaction(txn Transaction, succeeded *bool) error { + if txn == nil { + // Sometimes in SQLite mode we have nil transactions. If that's the case + // then we are working outside of a transaction and should do nothing here. + return nil + } if *succeeded { return txn.Commit() } else {