From aa19caee9f4ab0a810391a06f2886463000cd3f1 Mon Sep 17 00:00:00 2001 From: patrickhuie19 Date: Thu, 12 Dec 2024 13:02:28 -0500 Subject: [PATCH] checking addrConn is nil before proceeding with Invoke --- client.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client.go b/client.go index 374f92e..fd97571 100644 --- a/client.go +++ b/client.go @@ -372,6 +372,9 @@ func (cc *ClientConn) Close() error { func (cc *ClientConn) Invoke(ctx context.Context, method string, args interface{}, reply interface{}) error { // Ensure the connection state is ready cc.mu.RLock() + if cc.addrConn == nil { + return errors.New("client connection is not ready to proceed with Invoke") + } cc.addrConn.mu.RLock() state := cc.addrConn.state cc.addrConn.mu.RUnlock()