Skip to content

Commit b8bf298

Browse files
authored
fix: panic for empty hash var ({}) (#2417)
1 parent 9a91c4c commit b8bf298

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

taskfile/ast/var.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ type Var struct {
1818
func (v *Var) UnmarshalYAML(node *yaml.Node) error {
1919
switch node.Kind {
2020
case yaml.MappingNode:
21-
key := node.Content[0].Value
21+
key := "<none>"
22+
if len(node.Content) > 0 {
23+
key = node.Content[0].Value
24+
}
2225
switch key {
2326
case "sh", "ref", "map":
2427
var m struct {

0 commit comments

Comments
 (0)