avoid nil pointer dereference

This commit is contained in:
David Bresson 2017-02-03 08:39:57 -08:00
parent e7a7690815
commit 1c81a71f13
1 changed files with 4 additions and 1 deletions

View File

@ -898,7 +898,10 @@ func (a *ClientConfig) Merge(b *ClientConfig) *ClientConfig {
if b.ClientMinPort != 0 {
result.ClientMinPort = b.ClientMinPort
}
if b.Reserved != nil {
if result.Reserved == nil && b.Reserved != nil {
reserved := *b.Reserved
result.Reserved = &reserved
} else if b.Reserved != nil {
result.Reserved = result.Reserved.Merge(b.Reserved)
}
if b.GCInterval != 0 {