Fix a crash bug when a zero length message is received #165

Merged
merged 1 commit into from Sep 6, 2013

Conversation

Projects
None yet
2 participants
@shiwano
Contributor

shiwano commented May 7, 2013

Hello.

When a zero-length PRIVMSG / NOTICE message is sent to an channel that a node-irc bot is present in, it crashes with the following backtrace:

/home/shiwano/projects/lo_Ol/node_modules/hubot-irc/node_modules/irc/lib/irc.js:637
                    throw err;
                          ^
TypeError: Cannot read property '0' of undefined
  at Client.<anonymous> (/home/shiwano/projects/lo_Ol/node_modules/hubot-irc/node_modules/irc/lib/irc.js:468:25)
  at Client.EventEmitter.emit (events.js:95:17)
  at /home/shiwano/projects/lo_Ol/node_modules/hubot-irc/node_modules/irc/lib/irc.js:634:22
  at Array.forEach (native)
  at CleartextStream.<anonymous> (/home/shiwano/projects/lo_Ol/node_modules/hubot-irc/node_modules/irc/lib/irc.js:631:15)
  at CleartextStream.EventEmitter.emit (events.js:95:17)
  at CleartextStream.<anonymous> (_stream_readable.js:720:14)
  at CleartextStream.EventEmitter.emit (events.js:92:17)
  at emitReadable_ (_stream_readable.js:392:10)
  at _stream_readable.js:385:7
  at process._tickCallback (node.js:415:13)

I fixed it. Could you review it? Thanks.

@martynsmith

This comment has been minimized.

Show comment Hide comment
@martynsmith

martynsmith Sep 6, 2013

Owner

This looks reasonable to me :-)

Owner

martynsmith commented Sep 6, 2013

This looks reasonable to me :-)

martynsmith added a commit that referenced this pull request Sep 6, 2013

Merge pull request #165 from shiwano/fix-zero-length-message-error
Fix a crash bug when a zero length message is received

@martynsmith martynsmith merged commit ad044c3 into martynsmith:master Sep 6, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment