mirror of https://github.com/fluffle/goirc
Put nil checking in correct place.
This commit is contained in:
parent
33a5bff35b
commit
900afb5c48
|
@ -197,20 +197,19 @@ func (conn *Conn) recv() {
|
||||||
fmt.Println(t.Format(conn.TSFormat) + " <- " + s)
|
fmt.Println(t.Format(conn.TSFormat) + " <- " + s)
|
||||||
}
|
}
|
||||||
|
|
||||||
line := parseLine(s)
|
if line := parseLine(s); line != nil {
|
||||||
line.Time = t
|
line.Time = t
|
||||||
conn.in <- line
|
conn.in <- line
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// goroutine to dispatch events for lines received on input channel
|
// goroutine to dispatch events for lines received on input channel
|
||||||
func (conn *Conn) runLoop() {
|
func (conn *Conn) runLoop() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case line := <-conn.in:
|
case line := <-conn.in:
|
||||||
if line != nil {
|
|
||||||
conn.dispatchEvent(line)
|
conn.dispatchEvent(line)
|
||||||
}
|
|
||||||
case <-conn.cLoop:
|
case <-conn.cLoop:
|
||||||
// strobe on control channel, bail out
|
// strobe on control channel, bail out
|
||||||
return
|
return
|
||||||
|
|
Loading…
Reference in New Issue