fix: check conn is nil in safeConnClose
This commit is contained in:
parent
bffb0573a6
commit
9711390c18
1 changed files with 2 additions and 2 deletions
|
@ -134,7 +134,7 @@ func resolveUDPAddrWithPrefer(ctx context.Context, network, address string, pref
|
|||
}
|
||||
|
||||
func safeConnClose(c net.Conn, err error) {
|
||||
if err != nil {
|
||||
if err != nil && c != nil {
|
||||
_ = c.Close()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue