Skip to content

Commit

Permalink
check for nil pointer on function map
Browse files Browse the repository at this point in the history
  • Loading branch information
mrpye committed Jan 9, 2024
1 parent 8709136 commit cc822c0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,10 @@ func templateFuncMap(r *rand.Rand, fm *template.FuncMap) *template.FuncMap {
}

// Fix merge the user function maps with the template function map
for k, v := range *fm {
funcMap[k] = v
if fm != nil {
for k, v := range *fm {
funcMap[k] = v
}
}

return &funcMap
Expand Down

0 comments on commit cc822c0

Please sign in to comment.