Skip to content

Commit

Permalink
adding nil check before tr.Write call
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhuie19 committed Dec 4, 2024
1 parent 2759ce2 commit 19400fb
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,11 @@ func (cc *ClientConn) Invoke(ctx context.Context, method string, args interface{
cc.addrConn.mu.RUnlock()
cc.mu.RUnlock()

if tr == nil {
// addrConn is reconnecting
return errors.New("transport is unavailable for writing")
}

if err := tr.Write(ctx, reqB); err != nil {
return err
}
Expand Down

0 comments on commit 19400fb

Please sign in to comment.