From e80084316df4093de5ce1c5fd8709972bb18a3a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sat, 16 Sep 2023 22:34:39 +0800 Subject: [PATCH] Fix panic on create system proxy failed --- inbound/default.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/inbound/default.go b/inbound/default.go index cb6f61fe..de538e17 100644 --- a/inbound/default.go +++ b/inbound/default.go @@ -99,14 +99,16 @@ func (a *myInboundAdapter) Start() error { } else { listenAddrString = listenAddr.String() } - a.systemProxy, err = settings.NewSystemProxy(a.ctx, M.ParseSocksaddrHostPort(listenAddrString, listenPort), a.protocol == C.TypeMixed) + var systemProxy settings.SystemProxy + systemProxy, err = settings.NewSystemProxy(a.ctx, M.ParseSocksaddrHostPort(listenAddrString, listenPort), a.protocol == C.TypeMixed) if err != nil { return E.Cause(err, "initialize system proxy") } - err = a.systemProxy.Enable() + err = systemProxy.Enable() if err != nil { return E.Cause(err, "set system proxy") } + a.systemProxy = systemProxy } return nil }