From 25a319dc1ae29815a1a0902a0e2c60ed76792f2c Mon Sep 17 00:00:00 2001 From: Yuri Gorshenin Date: Tue, 10 Mar 2015 15:20:51 +0300 Subject: [PATCH] Fixed AlmostEqual() algorithm. --- base/string_utils.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/base/string_utils.cpp b/base/string_utils.cpp index 821e8c5da6..bc5dbd6f32 100644 --- a/base/string_utils.cpp +++ b/base/string_utils.cpp @@ -233,8 +233,10 @@ bool AlmostEqual(string const & str1, string const & str2, size_t mismatchedCoun mis = mismatch(mis.first, str1End, mis.second); if (mis.first == str1End && mis.second == str2End) return true; - ++mis.first; - ++mis.second; + if (mis.first != str1End) + ++mis.first; + if (mis.second != str2End) + ++mis.second; } return false; }