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:
parent
fae60ac08d
commit
6414a7bee3
1 changed files with 4 additions and 0 deletions
|
@ -15,6 +15,10 @@ func init() {
|
||||||
|
|
||||||
// Db returns the default *gorm.DB connection.
|
// Db returns the default *gorm.DB connection.
|
||||||
func Db() *gorm.DB {
|
func Db() *gorm.DB {
|
||||||
|
if dbConn == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
return dbConn.Db()
|
return dbConn.Db()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue