diff options
author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-09-13 12:11:11 -0400 |
---|---|---|
committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2011-09-13 12:11:11 -0400 |
commit | b2853c1a74ab86b3a06e76986d742323f6d89208 (patch) | |
tree | 7ce9cef683b03fc2989da1f639c9661488892ab7 /indra/llcommon/llstring.cpp | |
parent | b56e4cf0e428187c5ed4037b843c05610ed0da2a (diff) | |
parent | 18af6e397ef477287324b510471f640443ce0e33 (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; |