diff options
| author | Debi King (Dessie) <dessie@lindenlab.com> | 2011-10-06 14:00:26 -0400 |
|---|---|---|
| committer | Debi King (Dessie) <dessie@lindenlab.com> | 2011-10-06 14:00:26 -0400 |
| commit | 0a4b187301e1d5521dda7d2f157a94f02d597365 (patch) | |
| tree | 92cee20619bc5406670689bfa06bf9dc45c23bc4 /indra/llcommon/llstring.cpp | |
| parent | a7076142429eb604e4f756223b70ff85a5ea3490 (diff) | |
| parent | 6095127468f91770abe276b7d55754bbec228df3 (diff) | |
merged .hgtags
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; |
