Entity: Check if dbConn is nil before trying to return the connection

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer 2023-01-17 15:40:55 +01:00
parent fae60ac08d
commit 6414a7bee3

View file

@ -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()
}