mirror of https://github.com/go-gorm/gorm.git
Don't panic when using nil pointer, close #4168
This commit is contained in:
parent
675de6fc16
commit
14b9bd163c
|
@ -96,7 +96,7 @@ func (p *processor) Execute(db *DB) {
|
|||
if stmt.Dest != nil {
|
||||
stmt.ReflectValue = reflect.ValueOf(stmt.Dest)
|
||||
for stmt.ReflectValue.Kind() == reflect.Ptr {
|
||||
if stmt.ReflectValue.IsNil() {
|
||||
if stmt.ReflectValue.IsNil() && stmt.ReflectValue.CanAddr() {
|
||||
stmt.ReflectValue.Set(reflect.New(stmt.ReflectValue.Type().Elem()))
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue