scope.IndirectValue() and nil pointer
This is (patrial) solution for bug qor/qor#161. I can still reproduce it (in creation form), but this may be a qor issue.
This commit is contained in:
parent
aa45da1542
commit
dbdd08112e
6
scope.go
6
scope.go
@ -28,7 +28,11 @@ func (scope *Scope) IndirectValue() reflect.Value {
|
||||
if scope.indirectValue == nil {
|
||||
value := reflect.Indirect(reflect.ValueOf(scope.Value))
|
||||
if value.Kind() == reflect.Ptr {
|
||||
value = value.Elem()
|
||||
if !value.IsNil() {
|
||||
value = reflect.Indirect(value)
|
||||
} else {
|
||||
value.Set(reflect.New(value.Type().Elem()))
|
||||
}
|
||||
}
|
||||
scope.indirectValue = &value
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user