summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/users.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/users.cpp b/src/users.cpp
index 2cec79a95..b53989292 100644
--- a/src/users.cpp
+++ b/src/users.cpp
@@ -650,8 +650,12 @@ std::string userrec::GetBuffer()
* Usually there are only one or two of these,
* so its is computationally cheap to do.
*/
- while ((*recvq.begin() == '\r') || (*recvq.begin() == '\n'))
- recvq.erase(recvq.begin());
+ std::string::iterator t = recvq.begin();
+ while (t != recvq.end() && (*t == '\r' || *t == '\n'))
+ {
+ recvq.erase(t);
+ t = recvq.begin();
+ }
for (std::string::iterator x = recvq.begin(); x != recvq.end(); x++)
{