Fix a possible panic.

master
Robert Gerus 2015-12-09 10:23:54 +01:00
parent cf9ef1fe60
commit 8fe326d3e4
1 changed files with 5 additions and 1 deletions

View File

@ -109,7 +109,11 @@ func (c *Connection) Cleaner() {
defer c.l.Unlock()
log.Println(c.network, "cleaning up!")
c.quitrecv <- struct{}{}
c.conn.Close()
// there's a slight chance to hit this if quit request is received
// before irc connection is established, possibly between reconnects
if c.conn != nil {
c.conn.Close()
}
log.Println(c.network, "closing Cleaner")
return
case <-c.reconnectCleanup: