From 1c81a71f132d2351a74fd4b063b1f94511f089a1 Mon Sep 17 00:00:00 2001 From: David Bresson Date: Fri, 3 Feb 2017 08:39:57 -0800 Subject: [PATCH] avoid nil pointer dereference --- command/agent/config.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/command/agent/config.go b/command/agent/config.go index f842662f1..dc90c740f 100644 --- a/command/agent/config.go +++ b/command/agent/config.go @@ -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 {