diff options
author | prep <prep@lindenlab.com> | 2011-09-14 10:41:52 -0400 |
---|---|---|
committer | prep <prep@lindenlab.com> | 2011-09-14 10:41:52 -0400 |
commit | df40eca093b1a238daea9cd23c44f6e39719bf51 (patch) | |
tree | 205c15512a7fa363ebcea0de8e3ce16a3a58ca38 /indra/llcommon/llstring.cpp | |
parent | 4efca483d7dc8c8a50ebe247c6c163c263ed20f5 (diff) | |
parent | a250df980b3f37e245d30e51ab65831ae1de0ce0 (diff) |
merge
Diffstat (limited to 'indra/llcommon/llstring.cpp')
-rw-r--r-- | indra/llcommon/llstring.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/indra/llcommon/llstring.cpp b/indra/llcommon/llstring.cpp index f3b48b0156..e7fe656808 100644 --- a/indra/llcommon/llstring.cpp +++ b/indra/llcommon/llstring.cpp @@ -936,13 +936,18 @@ LLStringUtil::size_type LLStringUtil::getSubstitution(const std::string& instr, { const std::string delims (","); - // Find the first ] - size_type pos2 = instr.find(']', start); + // Find the first [ + size_type pos1 = instr.find('[', start); + if (pos1 == std::string::npos) + return std::string::npos; + + //Find the first ] after the initial [ + size_type pos2 = instr.find(']', pos1); if (pos2 == std::string::npos) return std::string::npos; - // Find the last [ before ] - size_type pos1 = instr.find_last_of('[', pos2-1); + // Find the last [ before ] in case of nested [[]] + pos1 = instr.find_last_of('[', pos2-1); if (pos1 == std::string::npos || pos1 < start) return std::string::npos; |