diff --git a/lib/protocol/Connection.js b/lib/protocol/Connection.js index c14a14c..6862578 100644 --- a/lib/protocol/Connection.js +++ b/lib/protocol/Connection.js @@ -226,7 +226,7 @@ Connection.prototype._addListeners = function _addListeners(socket) { socket.on('data', ondata); function onerror(err) { - var cb = self._state.receive; + var cb = self._state && self._state.receive; if (cb) { self._state.receive = null; // a callback should be called only once cb(err);