Check if conn is nil before closing

This commit is contained in:
Ken-Håvard Lieng 2016-01-12 22:03:49 +01:00
parent 81500cc89e
commit 6f9f3cff95
1 changed files with 3 additions and 1 deletions

View File

@ -84,7 +84,9 @@ func (c *Client) Quit() {
} }
close(c.quit) close(c.quit)
c.lock.Lock() c.lock.Lock()
c.conn.Close() if c.conn != nil {
c.conn.Close()
}
c.lock.Unlock() c.lock.Unlock()
}() }()
} }