Skip to content

Commit

Permalink
check CanSet first before set for same type
Browse files Browse the repository at this point in the history
  • Loading branch information
tiltwind committed May 5, 2023
1 parent f73a225 commit f9c7f78
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ func SetValue(dest, v reflect.Value) {
destType := dest.Type()

// for most cases, the types are the same and can set the value directly.
if destType == vType {
if dest.CanSet() && destType == vType {
dest.Set(v)
return
}
Expand Down

0 comments on commit f9c7f78

Please sign in to comment.