From 48742435f52bf2f1cf6f8cf496c9297d8fce1d1f Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 24 Jul 2010 03:31:41 -0400 Subject: [PATCH] Properly handle single messages received that have no newline --- src/sockets.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/sockets.cpp b/src/sockets.cpp index 861cd26d8..84c360fec 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -202,6 +202,11 @@ bool Socket::ProcessRead() sbuffer.append(buffer); extrabuf.clear(); size_t lastnewline = sbuffer.find_last_of('\n'); + if (lastnewline == std::string::npos) + { + extrabuf = sbuffer; + return true; + } if (lastnewline < sbuffer.size() - 1) { extrabuf = sbuffer.substr(lastnewline);