summaryrefslogtreecommitdiff
path: root/starmath/source/ooxmlexport.cxx
diff options
context:
space:
mode:
authorDinesh Patil <dinesh.patil@synerzip.com>2014-03-12 20:04:16 +0530
committerMichael Stahl <mstahl@redhat.com>2014-03-13 10:50:15 -0500
commitade1641ab632565820ede720b6151435aca4dd78 (patch)
treeb6effce13b14666df8148b0cfd628bcb18aef65a /starmath/source/ooxmlexport.cxx
parent66db6dd2bebefced1bc7e097710c2bf79f720d82 (diff)
fdo#76078: LO Crashes while saving the docx file containing only opening brace
- System handles an equation having opening brace and closing brace. - Whereas it fails to handle equations having only opening brace and no closing brace, due to which LO crashes with assertion while exporting. - Fixed this issue and added unit test case for the same. - Also fixed the same for closing brace alone. Change-Id: I34a8a635b42bfdfac265fb70b977c0001cd2b4ff Reviewed-on: https://gerrit.libreoffice.org/8561 Tested-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'starmath/source/ooxmlexport.cxx')
-rw-r--r--starmath/source/ooxmlexport.cxx21
1 files changed, 17 insertions, 4 deletions
diff --git a/starmath/source/ooxmlexport.cxx b/starmath/source/ooxmlexport.cxx
index 8d1c80809a71..0a98d985dc1d 100644
--- a/starmath/source/ooxmlexport.cxx
+++ b/starmath/source/ooxmlexport.cxx
@@ -453,8 +453,15 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel )
{
m_pSerializer->startElementNS( XML_m, XML_d, FSEND );
m_pSerializer->startElementNS( XML_m, XML_dPr, FSEND );
- m_pSerializer->singleElementNS( XML_m, XML_begChr,
- FSNS( XML_m, XML_val ), mathSymbolToString( pNode->OpeningBrace()).getStr(), FSEND );
+
+ //check if the node has an opening brace
+ if( TNONE == pNode->GetSubNode(0)->GetToken().eType )
+ m_pSerializer->singleElementNS( XML_m, XML_begChr,
+ FSNS( XML_m, XML_val ), "", FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_m, XML_begChr,
+ FSNS( XML_m, XML_val ), mathSymbolToString( pNode->OpeningBrace()).getStr(), FSEND );
+
std::vector< const SmNode* > subnodes;
if( pNode->Body()->GetType() == NBRACEBODY )
{
@@ -479,8 +486,14 @@ void SmOoxmlExport::HandleBrace( const SmBraceNode* pNode, int nLevel )
}
else
subnodes.push_back( pNode->Body());
- m_pSerializer->singleElementNS( XML_m, XML_endChr,
- FSNS( XML_m, XML_val ), mathSymbolToString( pNode->ClosingBrace()).getStr(), FSEND );
+
+ if( TNONE == pNode->GetSubNode(2)->GetToken().eType )
+ m_pSerializer->singleElementNS( XML_m, XML_endChr,
+ FSNS( XML_m, XML_val ), "", FSEND );
+ else
+ m_pSerializer->singleElementNS( XML_m, XML_endChr,
+ FSNS( XML_m, XML_val ), mathSymbolToString( pNode->ClosingBrace()).getStr(), FSEND );
+
m_pSerializer->endElementNS( XML_m, XML_dPr );
for( unsigned int i = 0; i < subnodes.size(); ++i )
{