Parcourir la source

fix network list build

Darien Raymond il y a 8 ans
Parent
commit
195594bed0
1 fichiers modifiés avec 7 ajouts et 0 suppressions
  1. 7 0
      tools/conf/common.go

+ 7 - 0
tools/conf/common.go

@@ -3,6 +3,7 @@ package conf
 import (
 	"encoding/json"
 	"strings"
+
 	"v2ray.com/core/common/errors"
 	"v2ray.com/core/common/log"
 	v2net "v2ray.com/core/common/net"
@@ -84,6 +85,12 @@ func (v *NetworkList) UnmarshalJSON(data []byte) error {
 }
 
 func (v *NetworkList) Build() *v2net.NetworkList {
+	if v == nil {
+		return &v2net.NetworkList{
+			Network: []v2net.Network{v2net.Network_TCP},
+		}
+	}
+
 	list := new(v2net.NetworkList)
 	for _, network := range *v {
 		list.Network = append(list.Network, network.Build())