Skip to content

Commit e8aecbc

Browse files
authored
Avoid panic
#5270 (comment)
1 parent 2dc9729 commit e8aecbc

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

app/proxyman/outbound/handler.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,8 +317,12 @@ func (h *Handler) Dial(ctx context.Context, dest net.Destination) (stat.Connecti
317317
conn, err := internet.Dial(ctx, dest, h.streamSettings)
318318
conn = h.getStatCouterConnection(conn)
319319
outbounds := session.OutboundsFromContext(ctx)
320-
ob := outbounds[len(outbounds)-1]
321-
ob.Conn = conn
320+
if outbounds != nil {
321+
ob := outbounds[len(outbounds)-1]
322+
ob.Conn = conn
323+
} else {
324+
// for Vision's pre-connect
325+
}
322326
return conn, err
323327
}
324328

proxy/vless/outbound/outbound.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ func (h *Handler) Process(ctx context.Context, link *transport.Link, dialer inte
176176
}
177177
defer conn.Close()
178178

179+
ob.Conn = conn // for Vision's pre-connect
180+
179181
iConn := conn
180182
if statConn, ok := iConn.(*stat.CounterConnection); ok {
181183
iConn = statConn.Connection

0 commit comments

Comments
 (0)