mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-14 21:31:16 +08:00
fix: npe
This commit is contained in:
parent
d6df026550
commit
2044458df9
@ -149,10 +149,12 @@ func (c *conn) AppendToChains(a C.ProxyAdapter) {
|
||||
|
||||
func NewConn(c net.Conn, a C.ProxyAdapter) C.Conn {
|
||||
var remoteDestination string
|
||||
if tcpAddr, ok := c.RemoteAddr().(*net.TCPAddr); ok {
|
||||
remoteDestination = tcpAddr.IP.String()
|
||||
} else {
|
||||
remoteDestination = parseRemoteDestination(a.Addr())
|
||||
if c != nil {
|
||||
if tcpAddr, ok := c.RemoteAddr().(*net.TCPAddr); ok {
|
||||
remoteDestination = tcpAddr.IP.String()
|
||||
} else {
|
||||
remoteDestination = parseRemoteDestination(a.Addr())
|
||||
}
|
||||
}
|
||||
|
||||
return &conn{c, []string{a.Name()}, remoteDestination}
|
||||
|
Loading…
Reference in New Issue
Block a user