Don't use invalid value to build conditions, close #3912

This commit is contained in:
Jinzhu 2021-01-05 18:01:51 +08:00
parent 60b769c2c8
commit 00a785cd68
1 changed files with 45 additions and 44 deletions

View File

@ -308,7 +308,7 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []
}
}
default:
reflectValue := reflect.Indirect(reflect.ValueOf(arg))
if reflectValue := reflect.Indirect(reflect.ValueOf(arg)); reflectValue.IsValid() {
if s, err := schema.Parse(arg, stmt.DB.cacheStore, stmt.DB.NamingStrategy); err == nil {
selectedColumns := map[string]bool{}
if idx == 0 {
@ -374,6 +374,7 @@ func (stmt *Statement) BuildCondition(query interface{}, args ...interface{}) []
}
}
}
}
return conds
}