diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-12-01 17:33:20 +0000 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2017-12-05 17:03:00 +0100 |
commit | 4963ea48961c7c4dc941c89afe56a1f84b31e66e (patch) | |
tree | 078372249230dba8cfca51bc66ba8aae4de77927 /starmath | |
parent | 36413dbca6cb6f8350bb92c5609759a26f7d9ab7 (diff) |
ofz#4531 Bad-cast
Change-Id: I152c2e7fa09fc637b176482de9718cf03880c23e
Reviewed-on: https://gerrit.libreoffice.org/45876
Reviewed-by: Michael Stahl <mstahl@redhat.com>
Tested-by: Michael Stahl <mstahl@redhat.com>
Diffstat (limited to 'starmath')
-rw-r--r-- | starmath/source/mathmlimport.cxx | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index e1537bf62d75..e252ee166a2b 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -2637,10 +2637,9 @@ void SmXMLTableContext_Impl::EndElement() auto nRows = rNodeStack.size()-nElementCount; sal_uInt16 nCols = 0; - SmStructureNode *pArray; for (auto i=nRows;i > 0;i--) { - pArray = static_cast<SmStructureNode *>(rNodeStack.front().release()); + SmNode* pArray = rNodeStack.front().release(); rNodeStack.pop_front(); if (pArray->GetNumSubNodes() == 0) { @@ -2656,22 +2655,24 @@ void SmXMLTableContext_Impl::EndElement() aRelationArray.resize(1); aRelationArray[0] = pArray; SmToken aDummy; - pArray = new SmExpressionNode(aDummy); - pArray->SetSubNodes(aRelationArray); + SmExpressionNode* pExprNode = new SmExpressionNode(aDummy); + pExprNode->SetSubNodes(aRelationArray); + pArray = pExprNode; } if (pArray->GetNumSubNodes() > nCols) nCols = pArray->GetNumSubNodes(); - aReverseStack.push_front(std::unique_ptr<SmStructureNode>(pArray)); + aReverseStack.push_front(std::unique_ptr<SmNode>(pArray)); } aExpressionArray.resize(nCols*nRows); size_t j=0; while ( !aReverseStack.empty() ) { - pArray = static_cast<SmStructureNode *>(aReverseStack.front().release()); + std::unique_ptr<SmStructureNode> xArray(static_cast<SmStructureNode*>(aReverseStack.front().release())); aReverseStack.pop_front(); - for (sal_uInt16 i=0;i<pArray->GetNumSubNodes();i++) - aExpressionArray[j++] = pArray->GetSubNode(i); + for (sal_uInt16 i = 0; i < xArray->GetNumSubNodes(); ++i) + aExpressionArray[j++] = xArray->GetSubNode(i); + xArray->SetSubNodes(SmNodeArray()); } SmToken aToken; |