-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Labels
area/apiEnhancement or issue related to the api/devfile specificationEnhancement or issue related to the api/devfile specificationkind/bugSomething isn't workingSomething isn't working
Description
I'm seeing this error when I try to validate starterproject in my devfile:
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x1988416]
goroutine 1 [running]:
github.com/devfile/api/v2/pkg/validation.ValidateStarterProjects(0xc00009b5f0, 0x2, 0x2, 0x0, 0x0)
/Users/stephanie/go/pkg/mod/github.com/devfile/api/v2@v2.0.0-20210202172954-6424f4139ac7/pkg/validation/projects.go:28 +0x136
It is because the CheckOutFrom is nil, but the code is trying to get the value of CheckOutFrom.Remote
api/pkg/validation/projects.go
Line 28 in 019d88e
| } else if gitSource.CheckoutFrom.Remote != "" { |
Need to check if CheckOutFrom != nil before deference it.
Same check should also applys to:
api/pkg/validation/projects.go
Lines 61 to 62 in 019d88e
| } else if len(gitSource.Remotes) > 1 || gitSource.CheckoutFrom.Remote != "" { | |
| err := validateRemoteMap(gitSource.Remotes, gitSource.CheckoutFrom.Remote, project.Name) |
Metadata
Metadata
Assignees
Labels
area/apiEnhancement or issue related to the api/devfile specificationEnhancement or issue related to the api/devfile specificationkind/bugSomething isn't workingSomething isn't working