Skip to content

Commit

Permalink
fix: nil pointer check for get/list projects
Browse files Browse the repository at this point in the history
  • Loading branch information
shreddedbacon committed Aug 6, 2024
1 parent 29f002e commit 9280dc3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion cmd/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ var getProjectCmd = &cobra.Command{
returnNonEmptyString(fmt.Sprintf("%v", project.GitURL)),
returnNonEmptyString(fmt.Sprintf("%v", project.ProductionEnvironment)),
returnNonEmptyString(fmt.Sprintf("%v", productionRoute)),
returnNonEmptyString(fmt.Sprintf("%v/%v", devEnvironments, *project.DevelopmentEnvironmentsLimit)),
}
if project.DevelopmentEnvironmentsLimit != nil {
projData = append(projData, returnNonEmptyString(fmt.Sprintf("%v/%v", devEnvironments, *project.DevelopmentEnvironmentsLimit)))
} else {
projData = append(projData, returnNonEmptyString(fmt.Sprintf("%v/%v", devEnvironments, 0)))
}
projHeader := []string{"ID", "ProjectName", "GitUrl", "ProductionEnvironment", "ProductionRoute", "DevEnvironments"}
if wide {
Expand Down
6 changes: 5 additions & 1 deletion cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,11 @@ var listProjectsCmd = &cobra.Command{
returnNonEmptyString(fmt.Sprintf("%v", project.GitURL)),
returnNonEmptyString(fmt.Sprintf("%v", project.ProductionEnvironment)),
returnNonEmptyString(fmt.Sprintf("%v", productionRoute)),
returnNonEmptyString(fmt.Sprintf("%v/%v", devEnvironments, *project.DevelopmentEnvironmentsLimit)),
}
if project.DevelopmentEnvironmentsLimit != nil {
projData = append(projData, returnNonEmptyString(fmt.Sprintf("%v/%v", devEnvironments, *project.DevelopmentEnvironmentsLimit)))
} else {
projData = append(projData, returnNonEmptyString(fmt.Sprintf("%v/%v", devEnvironments, 0)))
}
// if wide {
// projData = append(projData, returnNonEmptyString(fmt.Sprintf("%v", project.AutoIdle)))
Expand Down

0 comments on commit 9280dc3

Please sign in to comment.