summaryrefslogtreecommitdiff
path: root/indra/llcommon/llstring.cpp
diff options
context:
space:
mode:
authorLogan Dethrow <log@lindenlab.com>2011-09-09 14:20:19 -0400
committerLogan Dethrow <log@lindenlab.com>2011-09-09 14:20:19 -0400
commit8a952e42e97cfb286192aba0fbfc43986912cd29 (patch)
tree6aa00aad42189239aa81972328e057afc215bf7d /indra/llcommon/llstring.cpp
parentc47b398b75fcdbb479ad9ad2765014c5fa338df7 (diff)
parent89b9800579a37fbbdfca7789716a2d012d96cfa5 (diff)
Removed some spurious newlines that I introduced into CMakeLists.txt.
Diffstat (limited to 'indra/llcommon/llstring.cpp')
-rw-r--r--indra/llcommon/llstring.cpp13
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;