Skip to content

Commit dd1ed2f

Browse files
Fix nil pointer dereference on dbo
1 parent 0ab77f1 commit dd1ed2f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

dbo/plugin.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ func (x *xPlugin) Initialize(db *gorm.DB) (err error) {
2929

3030
func (x *xPlugin) onBeforeQuery() xPluginCallback {
3131
return func(db *gorm.DB) {
32+
if db == nil {
33+
return
34+
}
35+
3236
model := reflect.New(db.Statement.Schema.ModelType)
3337

3438
// Process Tags

0 commit comments

Comments
 (0)