1
0
mirror of https://github.com/go-task/task.git synced 2025-03-05 15:05:42 +02:00

fix: nil pointer when version is omitted (#1149)

This commit is contained in:
Pete Davison 2023-05-02 16:51:39 +01:00 committed by GitHub
parent 50d6e057d5
commit 7ec5cac56b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 0 deletions

View File

@ -5,6 +5,8 @@
- Starting on this release, official binaries for FreeBSD will be available to
download (#1068).
- Fix some errors being unintendedly supressed (#1134 by @clintmod).
- Fix a nil pointer error when `version` is omitted from a Taskfile (#1148,
#1149 by @pd93).
## v3.24.0 - 2023-04-15

View File

@ -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{}
}