diff options
author | Dave Parks <davep@lindenlab.com> | 2012-03-09 15:50:51 -0600 |
---|---|---|
committer | Dave Parks <davep@lindenlab.com> | 2012-03-09 15:50:51 -0600 |
commit | 8e60cdb3335ec198c71b29d37ab08c4aff9f8223 (patch) | |
tree | 2e043ee721d725dcc8d654a8f51eaafaaeb423de /indra/llcommon/llstring.cpp | |
parent | 1d200c56e151eb8fc384693175d1b9318ff0f919 (diff) | |
parent | 4b20d72a991cfebaf5765fe7756190f4a9645a3b (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; |