fix possible panic

This commit is contained in:
hzxuzhonghu 2018-01-04 15:39:18 +08:00
parent 46eabb7d91
commit 91dc55562c

View File

@ -207,7 +207,7 @@ func (r *proxyHandler) updateAPIService(apiService *apiregistrationapi.APIServic
serviceNamespace: apiService.Spec.Service.Namespace, serviceNamespace: apiService.Spec.Service.Namespace,
} }
newInfo.proxyRoundTripper, newInfo.transportBuildingError = restclient.TransportFor(newInfo.restConfig) newInfo.proxyRoundTripper, newInfo.transportBuildingError = restclient.TransportFor(newInfo.restConfig)
if newInfo.transportBuildingError == nil && r.proxyTransport.Dial != nil { if newInfo.transportBuildingError == nil && r.proxyTransport != nil && r.proxyTransport.Dial != nil {
switch transport := newInfo.proxyRoundTripper.(type) { switch transport := newInfo.proxyRoundTripper.(type) {
case *http.Transport: case *http.Transport:
transport.Dial = r.proxyTransport.Dial transport.Dial = r.proxyTransport.Dial