create closing bracket token only when necessary

Change-Id: Ifb705279ff01d4c886678a183de0499ec5bb119e
This commit is contained in:
Eike Rathke
2016-01-05 22:54:10 +01:00
parent 4ae7b66286
commit 22e5170af7

View File

@@ -4320,15 +4320,19 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula )
aCorrectedFormula += mxSymbols->getSymbol(ocArrayClose);
}
FormulaByteToken aToken( ocClose );
while( nBrackets-- )
if (nBrackets)
{
if( !pArr->AddToken( aToken ) )
FormulaByteToken aToken( ocClose );
while( nBrackets-- )
{
SetError(errCodeOverflow); break;
if( !pArr->AddToken( aToken ) )
{
SetError(errCodeOverflow);
break; // while
}
if ( bAutoCorrect )
aCorrectedFormula += mxSymbols->getSymbol(ocClose);
}
if ( bAutoCorrect )
aCorrectedFormula += mxSymbols->getSymbol(ocClose);
}
}
if ( nForced >= 2 )