Skip to content

Commit

Permalink
checking addrConn is nil before proceeding with Invoke
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhuie19 committed Dec 12, 2024
1 parent e8034e3 commit aa19cae
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit aa19cae

Please sign in to comment.