Skip to content

Commit

Permalink
fix nil pointer dereference (#656)
Browse files Browse the repository at this point in the history
* fix nil pointer dereference

* bump
  • Loading branch information
danielm-codefresh authored Dec 13, 2022
1 parent f0badb4 commit 30f734a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION=v0.1.17
VERSION=v0.1.18

OUT_DIR=dist
YEAR?=$(shell date +"%Y")
Expand Down
22 changes: 12 additions & 10 deletions cmd/commands/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -563,16 +563,18 @@ func setIngressHost(ctx context.Context, opts *RuntimeInstallOptions) error {
return fmt.Errorf("failed to get ingress controller info from your cluster: %w", err)
}

for _, s := range servicesList.Items {
if s.ObjectMeta.Name == opts.IngressController.Name() && s.Spec.Type == "LoadBalancer" {
if len(s.Status.LoadBalancer.Ingress) > 0 {
ingress := s.Status.LoadBalancer.Ingress[0]
if ingress.Hostname != "" {
foundHostName = ingress.Hostname
break
} else {
foundHostName = ingress.IP
break
if opts.IngressController != nil {
for _, s := range servicesList.Items {
if s.ObjectMeta.Name == opts.IngressController.Name() && s.Spec.Type == "LoadBalancer" {
if len(s.Status.LoadBalancer.Ingress) > 0 {
ingress := s.Status.LoadBalancer.Ingress[0]
if ingress.Hostname != "" {
foundHostName = ingress.Hostname
break
} else {
foundHostName = ingress.IP
break
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions docs/releases/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ cf version

```bash
# download and extract the binary
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.17/cf-linux-amd64.tar.gz | tar zx
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.18/cf-linux-amd64.tar.gz | tar zx

# move the binary to your $PATH
mv ./cf-linux-amd64 /usr/local/bin/cf
Expand All @@ -36,7 +36,7 @@ cf version

```bash
# download and extract the binary
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.17/cf-darwin-amd64.tar.gz | tar zx
curl -L --output - https://github.com/codefresh-io/cli-v2/releases/download/v0.1.18/cf-darwin-amd64.tar.gz | tar zx

# move the binary to your $PATH
mv ./cf-darwin-amd64 /usr/local/bin/cf
Expand Down

0 comments on commit 30f734a

Please sign in to comment.