Skip to content

Commit 3db05ee

Browse files
committed
Avoid segfault with unknown versions
If the version does not parse, then semver returns nil. It will still fail later on validation, but not crash... Signed-off-by: Anders F Björklund <[email protected]>
1 parent 5bf5e51 commit 3db05ee

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/limayaml/validate.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ func Validate(y *LimaYAML, warn bool) error {
4444
if err != nil {
4545
errs = errors.Join(errs, fmt.Errorf("can't parse builtin Lima version %q: %w", version.Version, err))
4646
}
47-
if versionutil.GreaterThan(*y.MinimumLimaVersion, limaVersion.String()) {
47+
if limaVersion != nil && versionutil.GreaterThan(*y.MinimumLimaVersion, limaVersion.String()) {
4848
errs = errors.Join(errs, fmt.Errorf("template requires Lima version %q; this is only %q", *y.MinimumLimaVersion, limaVersion.String()))
4949
}
5050
}

0 commit comments

Comments
 (0)