Merge pull request #10046 from hashicorp/clone-panic

Don't panic on nil UpstreamConfiguration.Clone()
This commit is contained in:
Freddy 2021-04-15 15:58:16 -06:00 committed by GitHub
commit d081df6295
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 0 deletions

View File

@ -217,6 +217,10 @@ type UpstreamConfiguration struct {
} }
func (c *UpstreamConfiguration) Clone() *UpstreamConfiguration { func (c *UpstreamConfiguration) Clone() *UpstreamConfiguration {
if c == nil {
return nil
}
var c2 UpstreamConfiguration var c2 UpstreamConfiguration
if len(c.Overrides) > 0 { if len(c.Overrides) > 0 {
c2.Overrides = make([]*UpstreamConfig, 0, len(c.Overrides)) c2.Overrides = make([]*UpstreamConfig, 0, len(c.Overrides))