wrapper/select/version: fix panic

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2020-04-20 02:47:52 +03:00
parent 7dc172a825
commit d24e1d19e4

View File

@ -29,6 +29,11 @@ func (w *latestVersionWrapper) Call(ctx context.Context, req client.Request, rsp
func filterLatestVersion() selector.Filter { func filterLatestVersion() selector.Filter {
return func(svcsOld []*registry.Service) []*registry.Service { return func(svcsOld []*registry.Service) []*registry.Service {
if len(svcsOld) <= 1 {
return svcsOld
}
var svcsNew []*registry.Service var svcsNew []*registry.Service
versions := make([]string, len(svcsOld)) versions := make([]string, len(svcsOld))