diff options
author | Richard Linden <none@none> | 2011-09-02 20:24:06 -0700 |
---|---|---|
committer | Richard Linden <none@none> | 2011-09-02 20:24:06 -0700 |
commit | fc45e9cbf6ea74412acd8bb55098cfd15493292b (patch) | |
tree | 27c697035feb1d5d7e6de07e9834d49271b5b1ee /indra/llcommon/llstring.cpp | |
parent | 0ab6eee0996c78d32b722157140cea5a21a5e460 (diff) | |
parent | 1836dd12c9b45e90aeab095dd4cc3e9cdcaf2190 (diff) |
Automated merge with http://hg.secondlife.com/viewer-development
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; |