mirror of
https://github.com/go-task/task.git
synced 2025-11-23 22:24:45 +02:00
fix: nil pointer when version is omitted (#1149)
This commit is contained in:
@@ -6,6 +6,8 @@ import (
|
||||
|
||||
"github.com/Masterminds/semver/v3"
|
||||
"gopkg.in/yaml.v3"
|
||||
|
||||
"github.com/go-task/task/v3/errors"
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -71,6 +73,9 @@ func (tf *Taskfile) UnmarshalYAML(node *yaml.Node) error {
|
||||
if tf.Expansions <= 0 {
|
||||
tf.Expansions = 2
|
||||
}
|
||||
if tf.Version == nil {
|
||||
return errors.New("task: 'version' is required")
|
||||
}
|
||||
if tf.Vars == nil {
|
||||
tf.Vars = &Vars{}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user