Skip to content

Commit

Permalink
safety guard
Browse files Browse the repository at this point in the history
  • Loading branch information
dadgar committed May 22, 2018
1 parent f7a4445 commit 4248e4b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions command/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,12 @@ func (a *Agent) clientConfig() (*clientconfig.Config, error) {
// host and -dev mode.
conf.Servers = a.config.Client.Servers
if a.server != nil {
if a.config.AdvertiseAddrs == nil || a.config.AdvertiseAddrs.RPC == "" {
return nil, fmt.Errorf("AdvertiseAddrs is nil or empty")
} else if a.config.normalizedAddrs == nil || a.config.normalizedAddrs.RPC == "" {
return nil, fmt.Errorf("normalizedAddrs is nil or empty")
}

conf.Servers = append(conf.Servers,
a.config.normalizedAddrs.RPC,
a.config.AdvertiseAddrs.RPC)
Expand Down

0 comments on commit 4248e4b

Please sign in to comment.