Only increment server stats if available

This commit is contained in:
Derek Collison
2013-01-02 18:15:55 -06:00
parent 3977043780
commit 0a45c0bc5a

View File

@@ -417,8 +417,10 @@ func (c *client) processMsg(msg []byte) {
c.inMsgs++
c.inBytes += int64(len(msg))
atomic.AddInt64(&c.srv.inMsgs, 1)
atomic.AddInt64(&c.srv.inBytes, int64(len(msg)))
if c.srv != nil {
atomic.AddInt64(&c.srv.inMsgs, 1)
atomic.AddInt64(&c.srv.inBytes, int64(len(msg)))
}
if trace {
c.traceMsg(msg)