Fix nil ptr error when rendering documents with no vars

This commit is contained in:
Tomaž Jerman
2021-07-27 12:35:57 +02:00
parent a547377f23
commit 4f7b306ac6
+6 -1
View File
@@ -176,7 +176,12 @@ func (h templatesHandler) render(ctx context.Context, args *templatesRenderArgs)
return nil, err
}
doc, err := h.tSvc.Render(ctx, tplID, args.DocumentType, args.Variables.Dict(), opts)
var vars map[string]interface{}
if args.hasVariables {
vars = args.Variables.Dict()
}
doc, err := h.tSvc.Render(ctx, tplID, args.DocumentType, vars, opts)
if err != nil {
return nil, err
}