sw/source/core/unocore/unocrsrhelper.cxx | 11 ++++++++--- sw/source/core/unocore/unoobj.cxx | 4 ++++ sw/source/core/unocore/unoobj2.cxx | 7 ++++--- 3 files changed, 16 insertions(+), 6 deletions(-)
New commits: commit b58dc1b9aee370a1a2aa9d8f951cede3ae24d61d Author: Michael Stahl <mst...@redhat.com> Date: Wed Jan 9 15:45:32 2013 +0100 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 Reviewed-on: https://gerrit.libreoffice.org/1615 Reviewed-by: Noel Power <noel.po...@suse.com> Tested-by: Noel Power <noel.po...@suse.com> 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 @@ sal_Bool getCrsrPropertyValue(const SfxItemPropertySimpleEntry& rEntry 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 @@ sal_Bool DocInsertStringSplitCR( 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 @@ throw (lang::IllegalArgumentException) { // 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 @@ lcl_FillFrame(SwClient & rEnum, SwUnoCrsr& rUnoCrsr, 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(); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits