From 9b4ddbed2c370aba050091a01b579b75b8e9b335 Mon Sep 17 00:00:00 2001 From: Adlyq <2833154405@qq.com> Date: Wed, 23 Mar 2022 13:48:21 +0800 Subject: [PATCH] [skip ci] [Pre] avoid npe --- adapter/outboundgroup/fallback.go | 2 +- adapter/outboundgroup/loadbalance.go | 2 +- adapter/outboundgroup/relay.go | 2 +- adapter/outboundgroup/selector.go | 2 +- adapter/outboundgroup/urltest.go | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/adapter/outboundgroup/fallback.go b/adapter/outboundgroup/fallback.go index 15486111..2e754133 100644 --- a/adapter/outboundgroup/fallback.go +++ b/adapter/outboundgroup/fallback.go @@ -97,7 +97,7 @@ func (f *Fallback) SupportUDP() bool { // MarshalJSON implements C.ProxyAdapter func (f *Fallback) MarshalJSON() ([]byte, error) { - var all []string + all := []string{} for _, proxy := range f.proxies(false) { all = append(all, proxy.Name()) } diff --git a/adapter/outboundgroup/loadbalance.go b/adapter/outboundgroup/loadbalance.go index 0a4dce9c..3a326187 100644 --- a/adapter/outboundgroup/loadbalance.go +++ b/adapter/outboundgroup/loadbalance.go @@ -150,7 +150,7 @@ func (lb *LoadBalance) proxies(touch bool) []C.Proxy { // MarshalJSON implements C.ProxyAdapter func (lb *LoadBalance) MarshalJSON() ([]byte, error) { - var all []string + all := []string{} for _, proxy := range lb.proxies(false) { all = append(all, proxy.Name()) } diff --git a/adapter/outboundgroup/relay.go b/adapter/outboundgroup/relay.go index f75bd336..d9b29637 100644 --- a/adapter/outboundgroup/relay.go +++ b/adapter/outboundgroup/relay.go @@ -69,7 +69,7 @@ func (r *Relay) DialContext(ctx context.Context, metadata *C.Metadata, opts ...d // MarshalJSON implements C.ProxyAdapter func (r *Relay) MarshalJSON() ([]byte, error) { - var all []string + all := []string{} for _, proxy := range r.rawProxies(false) { all = append(all, proxy.Name()) } diff --git a/adapter/outboundgroup/selector.go b/adapter/outboundgroup/selector.go index 32a8f247..d3b58b3f 100644 --- a/adapter/outboundgroup/selector.go +++ b/adapter/outboundgroup/selector.go @@ -50,7 +50,7 @@ func (s *Selector) SupportUDP() bool { // MarshalJSON implements C.ProxyAdapter func (s *Selector) MarshalJSON() ([]byte, error) { - var all []string + all := []string{} for _, proxy := range getProvidersProxies(s.providers, false, s.filter) { all = append(all, proxy.Name()) } diff --git a/adapter/outboundgroup/urltest.go b/adapter/outboundgroup/urltest.go index 60b28273..98269e6a 100644 --- a/adapter/outboundgroup/urltest.go +++ b/adapter/outboundgroup/urltest.go @@ -123,7 +123,7 @@ func (u *URLTest) SupportUDP() bool { // MarshalJSON implements C.ProxyAdapter func (u *URLTest) MarshalJSON() ([]byte, error) { - var all []string + all := []string{} for _, proxy := range u.proxies(false) { all = append(all, proxy.Name()) }