Permalink
Browse files

[Engine-IRC] Fixed endless loop in SplitMessage()

Fixed endless loop when splitting too long messages where the chunk starts
with a space and contains no other spaces.
  • Loading branch information...
meebey committed Mar 31, 2012
1 parent 6128347 commit 935d72498c8d26751949cc1e9ef6482482677f2e
Showing with 3 additions and 1 deletion.
  1. +3 −1 src/Engine-IRC/Protocols/Irc/IrcProtocolManager.cs
@@ -1305,7 +1305,9 @@ private IList<string> SplitMessage(string command, string target, string message
if (nextChar != " ") {
// we split in the middle of a word, split it better!
int lastWordPos = chunk.LastIndexOf(" ");
- if (lastWordPos != -1) {
+ if (lastWordPos > 0) {
+ // the chunk has to get smaller, else we run into an
+ // endless loop
chunk = chunk.Substring(0, lastWordPos);
}
}

0 comments on commit 935d724

Please sign in to comment.