Skip to content

Commit

Permalink
rpc: correctly check for nil before cast
Browse files Browse the repository at this point in the history
As part of the fix of #99104, a cast without a nil check was introduced.
This PR addresses that by only casting if it is known to be not nil.

Epic: none
Fixes: #100275
Release note: None
andrewbaptist committed Mar 31, 2023
1 parent 27c7beb commit 46feb6b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/rpc/context.go
Original file line number Diff line number Diff line change
@@ -2715,7 +2715,7 @@ func (rpcCtx *Context) loadOrCreateConnAttempt(
select {
case <-previousAttempt.initialHeartbeatDone:
// The connection attempt was completed, return the outcome of it.
err := previousAttempt.err.Load().(error)
err, _ := previousAttempt.err.Load().(error)
if err == nil {
// If it completed without error then don't track the connection
// anymore. If it did have an error we need to track it until it later gets cleared.

0 comments on commit 46feb6b

Please sign in to comment.