From 2ae34b5458dc34ae6dabdae4d63f473b6c81cfa7 Mon Sep 17 00:00:00 2001 From: Airat Arifullin Date: Fri, 6 Sep 2024 12:14:04 +0300 Subject: [PATCH] [#115] rpcclient: Fix type getters * Add type instance check for nil to avoid panic by accessing fields. Signed-off-by: Airat Arifullin --- rpc/client/conn.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/rpc/client/conn.go b/rpc/client/conn.go index f208413..447fe2e 100644 --- a/rpc/client/conn.go +++ b/rpc/client/conn.go @@ -20,5 +20,9 @@ type Conn interface { // Client should not be used after Close() call // on the connection: behavior is undefined. func (c *Client) Conn() io.Closer { + if c == nil { + return nil + } + return c.conn }