Don't preload when there are any error happened

This commit is contained in:
Jinzhu 2020-11-16 12:23:13 +08:00
parent c1bb8e4551
commit a9f54d53fb
1 changed files with 3 additions and 1 deletions

View File

@ -206,7 +206,9 @@ func Preload(db *gorm.DB) {
}
}
preload(db, rels, db.Statement.Preloads[name])
if db.Error == nil {
preload(db, rels, db.Statement.Preloads[name])
}
}
}
}