From 4f7b306ac67c9ace61f9e270ac2b6989d0b672bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Toma=C5=BE=20Jerman?= Date: Tue, 27 Jul 2021 12:35:34 +0200 Subject: [PATCH] Fix nil ptr error when rendering documents with no vars --- system/automation/templates_handler.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/system/automation/templates_handler.go b/system/automation/templates_handler.go index 6a56d672f..9f4c23e19 100644 --- a/system/automation/templates_handler.go +++ b/system/automation/templates_handler.go @@ -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 }