fix: check conn is nil in safeConnClose

This commit is contained in:
wwqgtxx 2022-12-13 18:09:19 +08:00
parent bffb0573a6
commit 9711390c18

View file

@ -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()
}
}