diff --git a/indra/newview/rlvhelper.cpp b/indra/newview/rlvhelper.cpp index 64daa124ca8e778f8c05b3ed1b4e146ec800a4f8..d50625070105db4f12c2011f9b4dc8fc176961b9 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--;