From fd01ead57523a9b1d3b8d6dab015fae2bf49b82d Mon Sep 17 00:00:00 2001 From: Sergey Sarbash Date: Tue, 15 Aug 2017 09:27:39 +0300 Subject: [PATCH] Fixes nil pointer dereferencing for Consul TLS transport --- registry/consul_registry.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/registry/consul_registry.go b/registry/consul_registry.go index 448616a1..a11c496b 100644 --- a/registry/consul_registry.go +++ b/registry/consul_registry.go @@ -81,6 +81,9 @@ func newConsulRegistry(opts ...Option) Registry { if options.Secure || options.TLSConfig != nil { config.Scheme = "https" // We're going to support InsecureSkipVerify + if config.HttpClient == nil { + config.HttpClient = new(http.Client) + } config.HttpClient.Transport = newTransport(options.TLSConfig) }