summaryrefslogtreecommitdiffhomepage
path: root/tpl/collections/merge.go
diff options
context:
space:
mode:
authorCameron Moore <[email protected]>2020-10-28 21:44:38 -0500
committerBjørn Erik Pedersen <[email protected]>2020-10-29 19:19:41 +0100
commit6d95dc9d74681cba53b46e79c6e1d58d27fcdfb0 (patch)
treee33858db9c3251ca6d2923e84b2c522f04351061 /tpl/collections/merge.go
parent56a343507ca28254edb891bc1c21b6c8ca017982 (diff)
downloadhugo-6d95dc9d74681cba53b46e79c6e1d58d27fcdfb0.tar.gz
hugo-6d95dc9d74681cba53b46e79c6e1d58d27fcdfb0.zip
tpl: Fix reflection bug in merge
Value.Type().Key() must only be called on map values. Fixes #7899
Diffstat (limited to 'tpl/collections/merge.go')
-rw-r--r--tpl/collections/merge.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/tpl/collections/merge.go b/tpl/collections/merge.go
index 029416142..de59de0af 100644
--- a/tpl/collections/merge.go
+++ b/tpl/collections/merge.go
@@ -106,6 +106,10 @@ func mergeMap(dst, src reflect.Value) reflect.Value {
dve := dv.Elem()
if dve.Kind() == reflect.Map {
sve := sv.Elem()
+ if sve.Kind() != reflect.Map {
+ continue
+ }
+
if dve.Type().Key() == sve.Type().Key() {
out.SetMapIndex(key, mergeMap(dve, sve))
}