From af5c148ed1d8e405978b71e7efe15d0a829cab50 Mon Sep 17 00:00:00 2001 From: Bart Date: Fri, 31 Jul 2020 22:54:18 +0000 Subject: admin,templates,core: Minor enhancements and error handling (#3607) * fix 2 possible bugs * handle unhandled errors --- modules/caddyhttp/reverseproxy/selectionpolicies.go | 3 +++ 1 file changed, 3 insertions(+) (limited to 'modules/caddyhttp/reverseproxy/selectionpolicies.go') diff --git a/modules/caddyhttp/reverseproxy/selectionpolicies.go b/modules/caddyhttp/reverseproxy/selectionpolicies.go index 7c36dec2d..e33ebe476 100644 --- a/modules/caddyhttp/reverseproxy/selectionpolicies.go +++ b/modules/caddyhttp/reverseproxy/selectionpolicies.go @@ -401,6 +401,9 @@ func leastRequests(upstreams []*Upstream) *Upstream { best = append(best, upstream) } } + if len(best) == 0 { + return nil + } return best[weakrand.Intn(len(best))] } -- cgit v1.2.3