From 6414a7bee3a342ec2696745c71f1212966cab757 Mon Sep 17 00:00:00 2001 From: Michael Mayer Date: Tue, 17 Jan 2023 15:40:55 +0100 Subject: [PATCH] Entity: Check if dbConn is nil before trying to return the connection Signed-off-by: Michael Mayer --- internal/entity/db.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/entity/db.go b/internal/entity/db.go index 0589623f5..52d543574 100644 --- a/internal/entity/db.go +++ b/internal/entity/db.go @@ -15,6 +15,10 @@ func init() { // Db returns the default *gorm.DB connection. func Db() *gorm.DB { + if dbConn == nil { + return nil + } + return dbConn.Db() }