From e9940d1b3d80171208d0615793eaff9364baaedd Mon Sep 17 00:00:00 2001 From: Kitty Barnett <develop@catznip.com> Date: Fri, 7 Oct 2011 23:11:02 +0200 Subject: [PATCH] - fixed : crash in rlvGetLastParenthesisedText() and rlvGetFirstParenthesisedText() (thankies Kadah) --HG-- branch : RLVa --- indra/newview/rlvhelper.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 64daa124ca8..d5062507010 100644 --- a/indra/newview/rlvhelper.cpp +++ b/indra/newview/rlvhelper.cpp @@ -1128,9 +1128,9 @@ std::string rlvGetFirstParenthesisedText(const std::string& strText, std::string return std::string(); const char* pstrText = strText.c_str(); idxIt = idxStart; - while ( (cntLevel > 0) && (idxIt < strText.length()) ) + while ( (cntLevel > 0) && (++idxIt < strText.length()) ) { - if ('(' == pstrText[++idxIt]) + if ('(' == pstrText[idxIt]) cntLevel++; else if (')' == pstrText[idxIt]) cntLevel--; @@ -1157,9 +1157,9 @@ std::string rlvGetLastParenthesisedText(const std::string& strText, std::string: return std::string(); const char* pstrText = strText.c_str(); idxIt = idxEnd; - while ( (cntLevel > 0) && (idxIt >= 0) ) + while ( (cntLevel > 0) && (--idxIt >= 0) && (idxIt < strText.length()) ) { - if (')' == pstrText[--idxIt]) + if (')' == pstrText[idxIt]) cntLevel++; else if ('(' == pstrText[idxIt]) cntLevel--; -- GitLab