diff options
author | Dinesh Patil <dinesh.patil@synerzip.com> | 2014-03-12 20:04:16 +0530 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2014-03-13 17:01:51 +0100 |
commit | cde6d800698522a804dc8f82c158ce7e0c3e05f5 (patch) | |
tree | 53ebe209789976044ae4de9e6c792c3e596d029a | |
parent | 3da21555accb654a3185bdac5532304ac6ce5b34 (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.
Reviewed-on: https://gerrit.libreoffice.org/8561
Tested-by: Michael Stahl <mstahl@redhat.com>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
(cherry picked from commit ade1641ab632565820ede720b6151435aca4dd78)
Signed-off-by: Michael Stahl <mstahl@redhat.com>
Conflicts:
sw/qa/extras/inc/swmodeltestbase.hxx
sw/qa/extras/ooxmlexport/ooxmlexport.cxx
Change-Id: I34a8a635b42bfdfac265fb70b977c0001cd2b4ff
-rw-r--r-- | starmath/source/ooxmlexport.cxx | 21 |
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 ) { |