Fixed error when a self-referencing closing bracket was omitted from the IfCondition

This commit is contained in:
Brian Ferguson 2013-11-05 10:41:33 -07:00
parent 521861a87d
commit cf86d365ad

View File

@ -251,11 +251,20 @@ bool IfActions::ReplaceSelf(std::wstring& condition, const WCHAR* section,
while ((pos = condition.find(measureName, pos)) != std::wstring::npos) while ((pos = condition.find(measureName, pos)) != std::wstring::npos)
{ {
condition.replace(pos, 1, eBracket.substr(0, 1)); condition.replace(pos, 1, eBracket.substr(0, 1));
pos = condition.find(sBracket[1], pos); pos = condition.find(sBracket.substr(1, 1), pos);
if (pos != std::wstring::npos)
{
condition.replace(pos, 1, eBracket.substr(1, 1)); condition.replace(pos, 1, eBracket.substr(1, 1));
++pos; ++pos;
replaced = true; replaced = true;
} }
else
{
replaced = false; // No closing bracket found
break;
}
}
return replaced; return replaced;
} }