From fd3c9194a4650eca5d220fda6f0ba6cbc422bea2 Mon Sep 17 00:00:00 2001 From: dwarf2000 Date: Sat, 10 Jan 2015 22:48:31 +0100 Subject: [PATCH] Fix _updateMaxLineLength() to not crash when this.hostMask is not set yet. --- lib/irc.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/irc.js b/lib/irc.js index b3087df4..24eb0cfe 100644 --- a/lib/irc.js +++ b/lib/irc.js @@ -1022,7 +1022,8 @@ Client.prototype.convertEncoding = function(str) { Client.prototype._updateMaxLineLength = function() { // 497 = 510 - (":" + "!" + " PRIVMSG " + " :").length; // target is determined in _speak() and subtracted there - this.maxLineLength = 497 - this.nick.length - this.hostMask.length; + var hostLength = (typeof (this.hostMask) === 'undefined') ? 0 : this.hostMask.length; + this.maxLineLength = 497 - this.nick.length - hostLength; }; /* * parseMessage(line, stripColors)