Only push new elements to parenStack when needed (via @lightmare) (ref #4096)

This commit is contained in:
Artem Pavlenko 2019-11-18 08:45:03 +00:00
parent a5a24f0260
commit 9dac8dcc34

View file

@ -161,7 +161,10 @@ UBool ScriptRun::next()
if (pairIndex >= 0) {
if ((pairIndex & 1) == 0) {
++parenSP;
parenStack.emplace_back(pairIndex, scriptCode);
if (static_cast<std::size_t>(parenSP) < parenStack.size())
parenStack[parenSP] = { pairIndex, scriptCode };
else
parenStack.emplace_back(pairIndex, scriptCode);
startSP = parenSP;
} else if (parenSP >= 0) {
int32_t pi = pairIndex & ~1;