summaryrefslogtreecommitdiff
path: root/formula
diff options
context:
space:
mode:
Diffstat (limited to 'formula')
-rw-r--r--formula/source/core/api/FormulaCompiler.cxx4
1 files changed, 3 insertions, 1 deletions
diff --git a/formula/source/core/api/FormulaCompiler.cxx b/formula/source/core/api/FormulaCompiler.cxx
index 346c8e3bd235..e1122c22b0fd 100644
--- a/formula/source/core/api/FormulaCompiler.cxx
+++ b/formula/source/core/api/FormulaCompiler.cxx
@@ -1569,7 +1569,7 @@ void FormulaCompiler::CreateStringFromTokenArray( String& rFormula )
{
rtl::OUStringBuffer aBuffer( pArr->GetLen() * 5 );
CreateStringFromTokenArray( aBuffer );
- rFormula = aBuffer;
+ rFormula = aBuffer.makeStringAndClear();
}
void FormulaCompiler::CreateStringFromTokenArray( rtl::OUStringBuffer& rBuffer )
@@ -1578,6 +1578,8 @@ void FormulaCompiler::CreateStringFromTokenArray( rtl::OUStringBuffer& rBuffer )
if( !pArr->GetLen() )
return;
+ rBuffer.ensureCapacity( pArr->GetLen() * 5 );
+
FormulaTokenArray* pSaveArr = pArr;
bool bODFF = FormulaGrammar::isODFF( meGrammar);
if (bODFF || FormulaGrammar::isPODF( meGrammar) )