Hi, I have submitted a patch for review:
https://gerrit.libreoffice.org/1615 To pull it, you can do: git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/15/1615/1 fdo#58242: sw: fix more crashes when not on SwTxtNode In getCrsrPropertyValue etc.; also add a unit test for the problem. (cherry picked from commit 68d40d2cae3700f4134375fcaf9649ac626ada7d) Conflicts: sw/qa/complex/writer/CheckTable.java Change-Id: Ibd459a43393c39b4fed9fb89aae4a5f7bacff007 --- M sw/source/core/unocore/unocrsrhelper.cxx M sw/source/core/unocore/unoobj.cxx M sw/source/core/unocore/unoobj2.cxx 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx index e41d237..aa9cc45 100644 --- a/sw/source/core/unocore/unocrsrhelper.cxx +++ b/sw/source/core/unocore/unocrsrhelper.cxx @@ -497,9 +497,9 @@ case FN_UNO_CHARFMT_SEQUENCE: { - SwTxtNode* pTxtNode; - if((pTxtNode = (SwTxtNode*)rPam.GetNode( sal_True )) == rPam.GetNode(sal_False) && - pTxtNode->GetpSwpHints()) + SwTxtNode *const pTxtNode = rPam.GetNode()->GetTxtNode(); + if (rPam.GetNode(sal_True) == rPam.GetNode(sal_False) + && pTxtNode && pTxtNode->GetpSwpHints()) { sal_uInt16 nPaMStart = rPam.GetPoint()->nContent.GetIndex(); sal_uInt16 nPaMEnd = rPam.GetMark() ? rPam.GetMark()->nContent.GetIndex() : nPaMStart; @@ -951,6 +951,11 @@ xub_StrLen nStartIdx = 0; SwTxtNode* const pTxtNd = rNewCursor.GetPoint()->nNode.GetNode().GetTxtNode(); + if (!pTxtNd) + { + SAL_INFO("sw.uno", "DocInsertStringSplitCR: need a text node"); + return false; + } const xub_StrLen nMaxLength = ( pTxtNd ) ? STRING_LEN - pTxtNd->GetTxt().Len() : STRING_LEN; diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx index 3bba084..d400286 100644 --- a/sw/source/core/unocore/unoobj.cxx +++ b/sw/source/core/unocore/unoobj.cxx @@ -556,6 +556,10 @@ { // multi selection is not considered SwTxtNode *const pTxtNd = rPam.GetNode()->GetTxtNode(); + if (!pTxtNd) + { + throw lang::IllegalArgumentException(); + } if (FN_UNO_NUM_LEVEL == rEntry.nWID) { sal_Int16 nLevel = 0; diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index ea121c1..6e0bf2f 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -1851,9 +1851,10 @@ FrameDependList_t & rFrames) { // search for objects at the cursor - anchored at/as char - SwTxtAttr const*const pTxtAttr = - rUnoCrsr.GetNode()->GetTxtNode()->GetTxtAttrForCharAt( - rUnoCrsr.GetPoint()->nContent.GetIndex(), RES_TXTATR_FLYCNT); + SwTxtAttr const*const pTxtAttr = (rUnoCrsr.GetNode()->IsTxtNode()) + ? rUnoCrsr.GetNode()->GetTxtNode()->GetTxtAttrForCharAt( + rUnoCrsr.GetPoint()->nContent.GetIndex(), RES_TXTATR_FLYCNT) + : 0; if (pTxtAttr) { const SwFmtFlyCnt& rFlyCnt = pTxtAttr->GetFlyCnt(); -- To view, visit https://gerrit.libreoffice.org/1615 To unsubscribe, visit https://gerrit.libreoffice.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibd459a43393c39b4fed9fb89aae4a5f7bacff007 Gerrit-PatchSet: 1 Gerrit-Project: core Gerrit-Branch: libreoffice-3-6 Gerrit-Owner: Michael Stahl <mst...@redhat.com> _______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice