Skip to content

Commit

Permalink
fix struct assignment when value is zero
Browse files Browse the repository at this point in the history
  • Loading branch information
purehyperbole committed Jul 13, 2021
1 parent 9d1db3b commit b0d6a43
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion change_value.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (c *ChangeValue) Set(value reflect.Value, convertCompatibleTypes bool) {
} else {
if value.IsValid() {
c.target.Set(value)
} else {
} else if !c.target.IsZero() {
t := c.target.Elem()
t.Set(reflect.Zero(t.Type()))
}
Expand Down

0 comments on commit b0d6a43

Please sign in to comment.