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,17 +4320,21 @@ ScTokenArray* ScCompiler::CompileString( const OUString& rFormula )
aCorrectedFormula += mxSymbols->getSymbol(ocArrayClose); aCorrectedFormula += mxSymbols->getSymbol(ocArrayClose);
} }
if (nBrackets)
{
FormulaByteToken aToken( ocClose ); FormulaByteToken aToken( ocClose );
while( nBrackets-- ) while( nBrackets-- )
{ {
if( !pArr->AddToken( aToken ) ) if( !pArr->AddToken( aToken ) )
{ {
SetError(errCodeOverflow); break; SetError(errCodeOverflow);
break; // while
} }
if ( bAutoCorrect ) if ( bAutoCorrect )
aCorrectedFormula += mxSymbols->getSymbol(ocClose); aCorrectedFormula += mxSymbols->getSymbol(ocClose);
} }
} }
}
if ( nForced >= 2 ) if ( nForced >= 2 )
pArr->SetRecalcModeForced(); pArr->SetRecalcModeForced();