Fix duplicated error when Scan, close #4525

This commit is contained in:
Jinzhu 2021-11-29 14:23:10 +08:00
parent e1b4c066a8
commit 270e38c518
2 changed files with 4 additions and 6 deletions

View File

@ -454,9 +454,7 @@ func (db *DB) Scan(dest interface{}) (tx *DB) {
tx = db.getInstance()
tx.Config = &config
if rows, err := tx.Rows(); err != nil {
tx.AddError(err)
} else {
if rows, err := tx.Rows(); err == nil {
defer rows.Close()
if rows.Next() {
tx.ScanRows(rows, dest)