Prevent nil pointer dereference inside corredor healthcheck

This commit is contained in:
Denis Arh
2022-05-25 15:49:13 +02:00
parent ac07f133b5
commit aeec20018c
+7
View File
@@ -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)
}