Permalink
Browse files

Ignore empty lines.

  • Loading branch information...
1 parent 17b05fc commit f3d838b5b1b7172bf24623d77a7387268f066b2e Scott Olson committed Apr 4, 2012
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/bot.c
View
@@ -113,8 +113,11 @@ void bot_run(bot *b) {
// Look for \r\n line endings and handle the lines if found
while(i < leftover + bytesread - 1) {
if(buf[i] == '\r' && buf[i + 1] == '\n') {
- buf[i] = '\0'; // End the string at the \r
- bot_handle_raw(b, buf + start);
+ // Don't do anything with empty lines.
+ if(start != i) {
+ buf[i] = '\0'; // End the string at the \r
+ bot_handle_raw(b, buf + start);
+ }
i += 2; // Skip the \r\n
start = i; // Next line starts after

0 comments on commit f3d838b

Please sign in to comment.