From 956f203b6eccce28841dc2a15993d1a6a2cc2266 Mon Sep 17 00:00:00 2001 From: prozacx Date: Tue, 10 May 2005 21:40:00 +0000 Subject: [PATCH] Fixed bug in RightTrim() and LeftTrim() for empty strings git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@257 726aef4b-f618-498e-8847-2d620e286838 --- String.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/String.cpp b/String.cpp index 31654981..b452de91 100644 --- a/String.cpp +++ b/String.cpp @@ -179,7 +179,7 @@ bool CString::Trim(const CString& s) { bool CString::LeftTrim(const CString& s) { bool bRet = false; - while (s.find(Left(1)) != CString::npos) { + while (length() && s.find(Left(1)) != CString::npos) { LeftChomp(); bRet = true; } @@ -190,7 +190,7 @@ bool CString::LeftTrim(const CString& s) { bool CString::RightTrim(const CString& s) { bool bRet = false; - while (s.find(Right(1)) != CString::npos) { + while (length() && s.find(Right(1)) != CString::npos) { RightChomp(); bRet = true; }