Return an empty config if nil

Since the Config is a read-only entity, Confg() method returned a value
instead of the pointer. In cases the config is nil, we should return an
empty config.

Signed-off-by: Madhu Venugopal <madhu@docker.com>
This commit is contained in:
Madhu Venugopal 2015-06-13 14:28:34 -07:00
parent 95e9118d7e
commit c85a58b6df

View file

@ -169,6 +169,9 @@ func (c *controller) hostLeaveCallback(hosts []net.IP) {
func (c *controller) Config() config.Config {
c.Lock()
defer c.Unlock()
if c.cfg == nil {
return config.Config{}
}
return *c.cfg
}