From 900afb5c488e797ed2efff4fabdb2b7e7017aa0c Mon Sep 17 00:00:00 2001 From: Alex Bramley Date: Wed, 27 Jul 2011 21:15:09 +0100 Subject: [PATCH] Put nil checking in correct place. --- client/connection.go | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/client/connection.go b/client/connection.go index fbbbf65..8c032e7 100644 --- a/client/connection.go +++ b/client/connection.go @@ -197,9 +197,10 @@ func (conn *Conn) recv() { fmt.Println(t.Format(conn.TSFormat) + " <- " + s) } - line := parseLine(s) - line.Time = t - conn.in <- line + if line := parseLine(s); line != nil { + line.Time = t + conn.in <- line + } } } @@ -208,9 +209,7 @@ func (conn *Conn) runLoop() { for { select { case line := <-conn.in: - if line != nil { - conn.dispatchEvent(line) - } + conn.dispatchEvent(line) case <-conn.cLoop: // strobe on control channel, bail out return