Skip to content

Commit a0d80fd

Browse files
committed
fix panic due to empty gw
1 parent 739b29a commit a0d80fd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/gateway/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ func (srv *Server) newProto(conn net.Conn) (Protocol, error) {
161161
// find all virtual services that bound to the gateway
162162
fn := func(key, value interface{}) bool {
163163
if vs, ok := value.(*istioapi.VirtualService); ok {
164-
if vs.Spec.Gateways[0] == srv.options.GwName &&
164+
if len(vs.Spec.Gateways) > 0 && vs.Spec.Gateways[0] == srv.options.GwName &&
165165
reflect.DeepEqual(vs.Spec.Hosts, srv.options.Hosts) {
166166
vss = append(vss, vs)
167167
}

0 commit comments

Comments
 (0)