2
0

Fix crash with pointer to nil struct

This commit is contained in:
Jack Christensen
2022-03-22 19:20:22 -05:00
parent 9f23ed84ba
commit 5ca048ed2d
2 changed files with 15 additions and 1 deletions
+6 -1
View File
@@ -952,7 +952,12 @@ func TryWrapStructScanPlan(target interface{}) (plan WrappedScanPlanNextSetter,
return nil, nil, false
}
targetElemValue := targetValue.Elem()
var targetElemValue reflect.Value
if targetValue.IsNil() {
targetElemValue = reflect.New(targetValue.Type().Elem())
} else {
targetElemValue = targetValue.Elem()
}
targetElemType := targetElemValue.Type()
if targetElemType.Kind() == reflect.Struct {