Просмотр исходного кода

add check for nil peer.Endpoint

Matthew R. Kasun 3 лет назад
Родитель
Сommit
6f739defc6
1 измененных файлов с 3 добавлено и 0 удалено
  1. 3 0
      netclient/local/routes.go

+ 3 - 0
netclient/local/routes.go

@@ -106,6 +106,9 @@ func FlushPeerRoutes(iface, currentAddr string, peers []wgtypes.Peer) {
 		for _, allowedIP := range peer.AllowedIPs {
 			deleteRoute(iface, &allowedIP, currentAddr)
 		}
+		if peer.Endpoint == nil {
+			continue
+		}
 		if hasRoute && !ncutils.IpIsPrivate(peer.Endpoint.IP) {
 			ipNet, err := ncutils.GetIPNetFromString(peer.Endpoint.IP.String())
 			if err != nil {