Skip to content

Commit

Permalink
Prevent nil pointer dereference inside corredor healthcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
darh committed May 25, 2022
1 parent 798c31e commit 2ff1108
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/corredor/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ func Healthcheck(_ context.Context) error {
return nil
}

if svc.conn == nil {
// working around edge-case where health-check is called
// but conn variable is not set;
// prevents nil pointer dereference error
return nil
}

if state := svc.conn.GetState(); state != connectivity.Ready {
return fmt.Errorf("connection is %s", state)
}
Expand Down

0 comments on commit 2ff1108

Please sign in to comment.