Skip to content

Commit

Permalink
Fix panic that occurs when a struct has a blank field
Browse files Browse the repository at this point in the history
This commit fixes darccio#174.
  • Loading branch information
abicky committed Jan 27, 2021
1 parent cd55aea commit 067abd9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func deepMerge(dst, src reflect.Value, visited map[uintptr]*visit, depth int, co
}
}
} else {
if (isReflectNil(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) {
if dst.CanSet() && (isReflectNil(dst) || overwrite) && (!isEmptyValue(src) || overwriteWithEmptySrc) {
dst.Set(src)
}
}
Expand Down

0 comments on commit 067abd9

Please sign in to comment.