diff options
author | Oz Linden <oz@lindenlab.com> | 2011-09-06 17:00:55 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-09-06 17:00:55 -0400 |
commit | 82b1b1bc6ee91e1778a16634fb9e2988da23fd71 (patch) | |
tree | 779821c923eca8413bf7e21fd699b1af3ef7e6f3 /indra/llcommon/llstring.cpp | |
parent | e2dea0b4947a1b0fefc1ddbe33ac74776128d1c5 (diff) | |
parent | fc45e9cbf6ea74412acd8bb55098cfd15493292b (diff) |
merge changes for storm-1588
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; |