Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maxLineLength undefined when splitting long lines #395

Closed
secretrobotron opened this issue Aug 24, 2015 · 1 comment
Closed

maxLineLength undefined when splitting long lines #395

secretrobotron opened this issue Aug 24, 2015 · 1 comment

Comments

@secretrobotron
Copy link
Contributor

It's possible to cause a Client's maxLineLength to be undefined, so that when it tries to split long lines, it fails:

/Users/secretrobotron/src/webmaker-projects-bot/node_modules/irc/lib/irc.js:923
    if (c.match(/\s/)) {
         ^
TypeError: Cannot read property 'match' of undefined
    at Client._splitLongLines (/Users/secretrobotron/src/webmaker-projects-bot/node_modules/irc/lib/irc.js:923:10)
    at /Users/secretrobotron/src/webmaker-projects-bot/node_modules/irc/lib/irc.js:960:36
    at Array.forEach (native)
    at Client._speak (/Users/secretrobotron/src/webmaker-projects-bot/node_modules/irc/lib/irc.js:959:12)
    at Client.say (/Users/secretrobotron/src/webmaker-projects-bot/node_modules/irc/lib/irc.js:946:10)
    at Request._callback (/Users/secretrobotron/src/webmaker-projects-bot/worker.js:78:21)
    at Request.self.callback (/Users/secretrobotron/src/webmaker-projects-bot/node_modules/request/request.js:198:22)
    at Request.emit (events.js:110:17)
    at Request.<anonymous> (/Users/secretrobotron/src/webmaker-projects-bot/node_modules/request/request.js:1073:14)
    at Request.emit (events.js:129:20)
@ghost
Copy link

ghost commented Sep 3, 2015

This is due to the none existent: 'this.maxLineLength' line 957.

Client.prototype._speak = function (kind, target, text) {
    var self = this;
    console.log(this);
    var maxLength = this.maxLineLength - target.length;  
    if (typeof text !== 'undefined') {
        text.toString().split(/\r?\n/).filter(function (line) {
            return line.length > 0;
        }).forEach(function (line) {

Not sure if this was removed, as I'm new to this project,

I changed this.maxLineLength to this.supported.channel.length the default value is 200, not sure if this is even the correct 'length' but it seems to work?? can anyone verify this for the Client object?

I'll submit a very small pull request if this IS the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant