Check that project ref is set before using

This commit is contained in:
Chris Roberts 2022-06-27 11:23:57 -07:00
parent 605c7f9d9f
commit ee85eed227

View File

@ -871,6 +871,10 @@ func WithProjectName(name string) ProjectOption {
// WithBasisRef is used to load or initialize the project
func WithProjectRef(r *vagrant_plugin_sdk.Ref_Project) ProjectOption {
return func(p *Project) (err error) {
// The ref value must be provided
if r == nil {
return errors.New("project reference cannot be nil")
}
// Basis must be set before we continue
if p.basis == nil {
return errors.New("basis must be set before loading project")