Skip to content

Commit 7b51c1d

Browse files
committed
Fix panic in nil map
1 parent 92769be commit 7b51c1d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

handlebars/handlebars.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,10 @@ func (e *Engine) Render(out io.Writer, template string, binding interface{}, lay
174174
return fmt.Errorf("render: layout %s does not exist", layout[0])
175175
}
176176
var bind map[string]interface{}
177-
if binding == nil {
178-
bind = make(map[string]interface{}, 1)
179-
} else if m, ok := binding.(map[string]interface{}); ok {
177+
if m, ok := binding.(map[string]interface{}); ok {
180178
bind = m
179+
} else {
180+
bind = make(map[string]interface{}, 1)
181181
}
182182
bind[e.layout] = raymond.SafeString(parsed)
183183
parsed, err := lay.Exec(bind)

0 commit comments

Comments
 (0)