[#115] rpcclient: Fix type getters
All checks were successful
DCO action / DCO (pull_request) Successful in 40s
Tests and linters / Lint (pull_request) Successful in 45s
Tests and linters / Tests (pull_request) Successful in 54s
Tests and linters / Tests with -race (pull_request) Successful in 1m12s

* Add type instance check for nil to avoid panic by
  accessing fields.

Signed-off-by: Airat Arifullin <a.arifullin@yadro.com>
This commit is contained in:
Airat Arifullin 2024-09-06 12:14:04 +03:00
parent 5e82e8c776
commit 2ae34b5458

View file

@ -20,5 +20,9 @@ type Conn interface {
// Client should not be used after Close() call // Client should not be used after Close() call
// on the connection: behavior is undefined. // on the connection: behavior is undefined.
func (c *Client) Conn() io.Closer { func (c *Client) Conn() io.Closer {
if c == nil {
return nil
}
return c.conn return c.conn
} }