From b82d9089bd7e25038c7a46c6df6bffc36953ccc8 Mon Sep 17 00:00:00 2001 From: Andinus Date: Thu, 9 Jan 2025 21:42:22 +0530 Subject: [PATCH] Fix nil pointer dereference --- template_nest.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/template_nest.go b/template_nest.go index aeafb5d..9037d88 100644 --- a/template_nest.go +++ b/template_nest.go @@ -279,6 +279,10 @@ func (nest *TemplateNest) MustRender(toRender interface{}) string { } func (nest *TemplateNest) Render(toRender interface{}) (string, error) { + if toRender == nil { + return "", nil + } + if reflect.TypeOf(toRender).Kind() == reflect.Slice { return nest.renderSlice(toRender) }