1
0
mirror of https://github.com/go-task/task.git synced 2025-10-08 23:02:02 +02:00

fix: panic for empty hash var ({}) (#2417)

This commit is contained in:
Timothy Rule
2025-09-12 20:29:40 +02:00
committed by GitHub
parent 9a91c4cb21
commit b8bf298c84

View File

@@ -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 := "<none>"
if len(node.Content) > 0 {
key = node.Content[0].Value
}
switch key {
case "sh", "ref", "map":
var m struct {