Skip to content

Commit 0a72772

Browse files
authored
Merge pull request #579 from Abirdcfly/fixrange
fix panic due to empty gw
2 parents 739b29a + 3187041 commit 0a72772

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)