From ccd44c8cfb291e863e6eaf65702dbfffa417b74d Mon Sep 17 00:00:00 2001 From: cxl Date: Thu, 25 Jul 2013 13:47:38 +0000 Subject: [PATCH] Core: Fixed String::ReverseFind with empty string git-svn-id: svn://ultimatepp.org/upp/trunk@6211 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/Core/String.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/uppsrc/Core/String.h b/uppsrc/Core/String.h index a09b096af..d9a3f5ce6 100644 --- a/uppsrc/Core/String.h +++ b/uppsrc/Core/String.h @@ -92,8 +92,8 @@ public: int ReverseFind(int len, const tchar *s, int from) const; int ReverseFind(const tchar *s, int from) const; int ReverseFind(const String& s, int from) const { return ReverseFind(s.GetCount(), ~s, from); } - int ReverseFind(const tchar *s) const { return ReverseFind(s, GetLength()-1);} - int ReverseFind(const String& s) const { return ReverseFind(s, GetLength()-1);} + int ReverseFind(const tchar *s) const { return GetLength() ? ReverseFind(s, GetLength()-1) : -1;} + int ReverseFind(const String& s) const { return GetLength() ? ReverseFind(s, GetLength()-1) : -1;} void Replace(const tchar *find, int findlen, const tchar *replace, int replacelen); void Replace(const String& find, const String& replace);