Skip to content

Commit

Permalink
fix: fix nil pointer exception
Browse files Browse the repository at this point in the history
  • Loading branch information
artaasadi committed Dec 8, 2024
1 parent bbbd6d3 commit 7fcf141
Showing 1 changed file with 21 additions and 12 deletions.
33 changes: 21 additions & 12 deletions provider/describer/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,23 +51,32 @@ func GetRepositoryWorkflows(ctx context.Context, githubClient GitHubClient, stre
return nil, err
}
for _, workflow := range workflows.Workflows {
fileContent, err := getWorkflowFileContent(ctx, client, workflow, owner, repo)
if err != nil {
return nil, err
if workflow == nil {
continue
}
content, err := fileContent.GetContent()
var pipeline *goPipeline.Pipeline
var content string

fileContent, err := getWorkflowFileContent(ctx, client, workflow, owner, repo)
if err != nil {
return nil, err
}
fileContentBasic := FileContent{
Repository: repo,
FilePath: fileContent.GetPath(),
Content: content,
}
pipeline, err := decodeFileContentToPipeline(fileContentBasic)
if err != nil {
return nil, err
if fileContent != nil {
content, err = fileContent.GetContent()
if err != nil {
return nil, err
}
fileContentBasic := FileContent{
Repository: repo,
FilePath: fileContent.GetPath(),
Content: content,
}
pipeline, err = decodeFileContentToPipeline(fileContentBasic)
if err != nil {
return nil, err
}
}

value := models.Resource{
ID: strconv.Itoa(int(workflow.GetID())),
Name: workflow.GetName(),
Expand Down

0 comments on commit 7fcf141

Please sign in to comment.