From b8bf298c8405b362e53faf64c5acf4668a750ebb Mon Sep 17 00:00:00 2001 From: Timothy Rule <34501912+trulede@users.noreply.github.com> Date: Fri, 12 Sep 2025 20:29:40 +0200 Subject: [PATCH] fix: panic for empty hash var (`{}`) (#2417) --- taskfile/ast/var.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/taskfile/ast/var.go b/taskfile/ast/var.go index 0806e423..f03091b8 100644 --- a/taskfile/ast/var.go +++ b/taskfile/ast/var.go @@ -18,7 +18,10 @@ type Var struct { func (v *Var) UnmarshalYAML(node *yaml.Node) error { switch node.Kind { case yaml.MappingNode: - key := node.Content[0].Value + key := "" + if len(node.Content) > 0 { + key = node.Content[0].Value + } switch key { case "sh", "ref", "map": var m struct {