Be safe when closing in destroy in case client is nil

This commit is contained in:
James Shubin
2016-07-25 21:46:08 -04:00
parent cafe0e4ec2
commit a606961a22

View File

@@ -399,7 +399,9 @@ func (obj *EmbdEtcd) Destroy() error {
obj.exitchan <- struct{}{} // cause main loop to exit obj.exitchan <- struct{}{} // cause main loop to exit
obj.rLock.Lock() obj.rLock.Lock()
obj.client.Close() if obj.client != nil {
obj.client.Close()
}
obj.client = nil obj.client = nil
obj.rLock.Unlock() obj.rLock.Unlock()