sw/source/filter/html/htmlnumreader.cxx | 14 ++++++++++++-- sw/source/filter/html/htmltab.cxx | 8 ++++---- 2 files changed, 16 insertions(+), 6 deletions(-)
New commits: commit e867b393ef95cb9bec7f68787771dfa329b00bea Author: Caolán McNamara <caol...@redhat.com> Date: Mon Dec 18 20:37:33 2017 +0000 ofz: Null-deref Change-Id: I9992191fe5b4cfd771cc36a61d0ebaa8a9e6e9db Reviewed-on: https://gerrit.libreoffice.org/46743 Reviewed-by: Caolán McNamara <caol...@redhat.com> Tested-by: Caolán McNamara <caol...@redhat.com> diff --git a/sw/source/filter/html/htmlnumreader.cxx b/sw/source/filter/html/htmlnumreader.cxx index 79207a9ed43b..7ae3230f7332 100644 --- a/sw/source/filter/html/htmlnumreader.cxx +++ b/sw/source/filter/html/htmlnumreader.cxx @@ -471,6 +471,13 @@ void SwHTMLParser::NewNumBulListItem( HtmlTokenId nToken ) AppendTextNode( AM_NOSPACE, false ); m_bNoParSpace = false; // no space in <LI>! + SwTextNode* pTextNode = m_pPam->GetNode().GetTextNode(); + if (!pTextNode) + { + SAL_WARN("sw.html", "No Text-Node at PaM-Position"); + return; + } + const bool bCountedInList = nToken != HtmlTokenId::LISTHEADER_ON; std::unique_ptr<HTMLAttrContext> xCntxt(new HTMLAttrContext(nToken)); @@ -506,7 +513,6 @@ void SwHTMLParser::NewNumBulListItem( HtmlTokenId nToken ) m_nOpenParaToken = nToken; } - SwTextNode* pTextNode = m_pPam->GetNode().GetTextNode(); static_cast<SwContentNode *>(pTextNode)->SetAttr( SwNumRuleItem(aNumRuleName) ); pTextNode->SetAttrListLevel(nLevel); // #i57656# - <IsCounted()> state of text node has to be adjusted accordingly. @@ -600,7 +606,11 @@ void SwHTMLParser::EndNumBulListItem( HtmlTokenId nToken, bool bSetColl ) void SwHTMLParser::SetNodeNum( sal_uInt8 nLevel ) { SwTextNode* pTextNode = m_pPam->GetNode().GetTextNode(); - OSL_ENSURE( pTextNode, "No Text-Node at PaM-Position" ); + if (!pTextNode) + { + SAL_WARN("sw.html", "No Text-Node at PaM-Position"); + return; + } OSL_ENSURE( GetNumInfo().GetNumRule(), "No numbering rule" ); const OUString& rName = GetNumInfo().GetNumRule()->GetName(); diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 1361c574fcea..3a49139fc00e 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -3597,11 +3597,11 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, } SwNode const*const pNd = & m_pPam->GetPoint()->nNode.GetNode(); - if( !bAppended && !bForceFrame ) + SwTextNode *const pOldTextNd = (!bAppended && !bForceFrame) ? + pSavePos->nNode.GetNode().GetTextNode() : nullptr; + + if (pOldTextNd) { - SwTextNode *const pOldTextNd = - pSavePos->nNode.GetNode().GetTextNode(); - OSL_ENSURE( pOldTextNd, "Why we aren't in a text node?" ); SwFrameFormat *pFrameFormat = pSwTable->GetFrameFormat(); const SfxPoolItem* pItem2;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits