You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
libreoffice/0001-Related-i58612-don-t-c...

103 lines
3.8 KiB

From 3524727db0f3cfecf3a47046795c527808c10c3e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
Date: Thu, 23 Jun 2011 15:14:00 +0100
Subject: [PATCH] Related: #i58612# don't crash anyway
---
sw/source/core/text/frmform.cxx | 11 ++++++-----
sw/source/core/text/inftxt.cxx | 3 ++-
sw/source/core/text/txtfly.cxx | 6 ++++--
sw/source/core/text/txtfrm.cxx | 7 +++++--
4 files changed, 17 insertions(+), 10 deletions(-)
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 6a4be32..6b3b9cc 100755
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -1463,10 +1463,11 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
if( IsFollow() && IsFieldFollow() && rLine.GetStart() == GetOfst() )
{
- const SwLineLayout* pLine;
+ SwTxtFrm *pMaster = FindMaster();
+ OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" );
+ const SwLineLayout* pLine=NULL;
+ if (pMaster)
{
- SwTxtFrm *pMaster = FindMaster();
- OSL_ENSURE( pMaster, "SwTxtFrm::Format: homeless follow" );
if( !pMaster->HasPara() )
pMaster->GetFormatted();
SwTxtSizeInfo aInf( pMaster );
@@ -1474,8 +1475,8 @@ void SwTxtFrm::_Format( SwTxtFormatter &rLine, SwTxtFormatInfo &rInf,
aMasterLine.Bottom();
pLine = aMasterLine.GetCurr();
}
- SwLinePortion* pRest =
- rLine.MakeRestPortion( pLine, GetOfst() );
+ SwLinePortion* pRest = pLine ?
+ rLine.MakeRestPortion(pLine, GetOfst()) : NULL;
if( pRest )
rInf.SetRest( pRest );
else
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index 570b3c6..a76d746 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -1465,7 +1465,8 @@ void SwTxtFormatInfo::Init()
if ( GetTxtFrm()->IsFollow() )
{
const SwTxtFrm* pMaster = GetTxtFrm()->FindMaster();
- const SwLinePortion* pTmpPara = pMaster->GetPara();
+ OSL_ENSURE(pMaster, "pTxtFrm without Master");
+ const SwLinePortion* pTmpPara = pMaster ? pMaster->GetPara() : NULL;
// there is a master for this follow and the master does not have
// any contents (especially it does not have a number portion)
diff --git a/sw/source/core/text/txtfly.cxx b/sw/source/core/text/txtfly.cxx
index 2d21ece..fbff110 100644
--- a/sw/source/core/text/txtfly.cxx
+++ b/sw/source/core/text/txtfly.cxx
@@ -890,7 +890,7 @@ sal_Bool SwTxtFly::IsAnyObj( const SwRect &rRect ) const
const SwCntntFrm* SwTxtFly::_GetMaster()
{
pMaster = pCurrFrm;
- while( pMaster->IsFollow() )
+ while( pMaster && pMaster->IsFollow() )
pMaster = (SwCntntFrm*)pMaster->FindMaster();
return pMaster;
}
@@ -1551,7 +1551,9 @@ SwAnchoredObjList* SwTxtFly::InitAnchoredObjList()
SwTwips SwTxtFly::CalcMinBottom() const
{
SwTwips nRet = 0;
- const SwSortedObjs *pDrawObj = GetMaster()->GetDrawObjs();
+ const SwCntntFrm *pLclMaster = GetMaster();
+ OSL_ENSURE(pLclMaster, "SwTxtFly without master");
+ const SwSortedObjs *pDrawObj = pLclMaster ? pLclMaster->GetDrawObjs() : NULL;
const sal_uInt32 nCount = pDrawObj ? pDrawObj->Count() : 0;
if( nCount )
{
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 6e5f764..9e4a237 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -646,9 +646,12 @@ void SwTxtFrm::HideAndShowObjects()
}
}
- if ( IsFollow() )
+ if (IsFollow())
{
- FindMaster()->HideAndShowObjects();
+ SwTxtFrm *pMaster = FindMaster();
+ OSL_ENSURE(pMaster, "SwTxtFrm without master");
+ if (pMaster)
+ pMaster->HideAndShowObjects();
}
}
--
1.7.6.4